I have Tableau data which consists of Customer Name and Invoice Date.
Cust 1 - 01/01/2014
Cust 1 - 05/01/2014
Cust 2 - 10/02/2014
Cust 2 - 20/03/2014
etc.
I want to find the number of days since the last invoice for each customer and display the data in a table as follows:
Customer | # of days since last invoice
Cust 1 | 170 days
Cust 2 | 110 days
Once you have the customer field in the rows shelf,
Create a calculated field like this
DATEDIFF('day',MAX([InvoiceDate]),NOW())
Drag this calculated field to the TEXT mark.
Related
I have a Crystal Reports that has several Groups as noted below. I need to return a total for each Customer Group by the items (I could have 6 invoices that have Item 1 - 3 on each)I want to see a total for each item - rather than seeing 18 lines - just 3 aggregated by Item
Group1 Customer
ABC001
XYZ002
DEF001
Group2 Invoice #
017700
017702
017703
Group3 Details from Items on Invoice (I needed this to load in taxes to Sales & COGS)
Item 1
Item 2
Item 3
Insert a CrossTab in GH1 or GF1 that shows totals by Item.
note: could also be done with a subreport, but CrossTab is easier and faster.
I have some sales data in InfluxDB, basically every 10 seconds I record the total number of sales from SQL, then break that down into sales of different items in the fields.
So a row might look like:
time Bicycles Shovels Hats Candles Sales
01/01/2019 12 6 2 4 24
02/01/2019 14 9 3 5 31
(This is dummy data for this question and doesn't reflect the number in the images, which are from production tests I've been doing with actual data)
It's important to stress this is accumulative, each entry grows by the number of sales.
I can then use Grafana to show me the difference(max(sales)) group by time(1d) to show the total sales (per day in this case)
What I am also trying to do is show the most sales per group (day) in a table, a record sales table, how well we have done in the past.
So I have 3 queries in Grafana:
SELECT time, max(difference) FROM (
SELECT difference(max("Sales"))
FROM "autogen"."Paid_Orders"
WHERE $timeFilter
GROUP BY time(1d) fill(none)
)
Swap "sales" for bicycles and hats (whatever) in the subsequent queries and I end up with a table that looks like:
Problem is I don't know which line is which field. Normally (in SQL) I would do something like SELECT 'Sales' as Type, etc... to add in a column with "Sales" in it. But I can't see that as an option in either Grafana or Influx.
Am I recording the data wrong and could I be leveraging Tags for this?
How can I identify the rows in this table?
yes, your data structure doesn't look good. Instead of one record:
time Bicycles Shovels Hats Candles Sales
01/01/2019 12 6 2 4 24
save multiple records with different item tag (sales is int field):
time item sales
01/01/2019 Bicycles 12
01/01/2019 Shovels 6
01/01/2019 Hats 2
01/01/2019 Candles 4
Then group by time AND item tag + SPREAD function can be used to remove subquery, e.g.
SELECT time, SPREAD(sales)
FROM "autogen"."Paid_Orders"
WHERE $timeFilter
GROUP BY time(1d), "item" fill(none)
I have fields for customer names, customer account numbers, date of previous orders, and order values. I want an alert to show which customers have ordered at least three times over the reporting period. We can have more than one invoice for a given delivery. The main report looks like:
Account Number Acct Name Order Date Order Total
1001 Fred Smith 1/2/2016 £1.06
1001 Fred Smith 1/2/2016 £2.34
1001 Fred Smith 8/2/2016 £5.42
2001 Aled Jones 1/2/2016 £2.90
2001 Aled Jones 8/2/2016 £3.45
I've tried concatenating the account number and order date in a column via function and running an alert based on its distinct count. (After converting the date to a string.) But it still doesn't generate a list of distinct items.
What I currently have in the final column is a function that concatenates the date and account number to give a unique field with {ORDR.CardCode} + Cstr({ORDR.DocDate}) - Which returns:
1001 1/2/2016
1001 1/2/2016
1001 8/2/2016
2001 1/2/2016
2001 8/2/2016
I want to generate alert based on this field via the distinct count function and a report of any customer who ordered at least twice in the report period.
DistinctCount ({#Concat code and date}) >2
Even after this I still don't get what I need. How can I get a list of every customer who has ordered in the report period for at least two times?
You have travelled half way... to achive continue from here.
USe the created formula {ORDR.CardCode} + Cstr({ORDR.DocDate}) to create a group.
place same formula in details and take count of the records in group footer
Now create a alert on group footer summation to get the desired result
Edit........
Since you need customer then add customer in concat fornula and then create group.
acctnamr+{ORDR.CardCode} + Cstr({ORDR.DocDate})
Now place the customer name in group header and follow process as explained above
I would like to know which is the best way to include null values in the report while using the below groups. My below report uses two groups one below other, Month group is under the field group. I have given the formula for the Field Group A; and for for the month I have used options to fetch the months from the specific date field [source is excel file] in ascending order. Since there are no data for group A - 1 records for October month I don't see any data whereas I would want to show the month with NA as result.
Report looks like below currently
Field GROUP -A - 1
Month Result
11-2012 xxx
12-2012 xxx
Field Group A- 0
Month Result
10-2012 xxx
11-2012 XXX
12-2012 xxx
But I would like the report to be as below:
Field GROUP -A - 1
Month Result
10-2012 NA
11-2012 xxx
12-2012 xxx
Field Group A- 0
Month Result
10-2012 xxx
11-2012 XXX
12-2012 xxx
Any suggestions will be helpful
Crystal Reports can't show the data, because there isn't any data to show.
There's only one instance I'm aware of where Crystal Reports will auto-fill NULL data, and that's when using a crosstab, which really doesn't appear to fit your needs or desired output.
You'll have to supply the "N/A" value for 10-2012, Group 1 in your query, possibly by using some table of dates to outer join against.
hi all i wana ask a question about crystal reporting in vs 2008
lets say i have a report with these data
customer_ID Customer_Name Order_amoont Order_Date
(#group1 VipCustomer)
1 xyz 3 1/1/2010
2 abc 4 2/2/2010
5 sds 21 3/12/2009
(#Group2 NormalCustomer)
3 tyt 2 3/3/2010
4 ha 4 21/3/2009
i want only to display records where Order_Date year is in 2010 only so i went to the section expert and i added a condintion in suppress formula Year(order_Date)=2010 and i get the result ,,the question is how to count how many vip customers ordered in 2010 only and how many normal customer order in 2010 only ,,then i want the total number of both type of customers to be displayed to have a report like that::
customer_ID Customer_Name Order_amoont Order_Date
(#group1 VipCustomer)
1 xyz 3 1/1/2010
2 abc 4 2/2/2010
subtotal 2
(#Group2 NormalCustomer)
3 tyt 2 3/3/2010
subtotal 1
total 3
i know that answer ,and i will answer it
1-make a conditional formula field and add to it this condtion
if year(Order_Date)=2010 then 1
2-then add summary to the formula filed
--to get total place this summary in the report footer
--to get sub-total place this symmary in group footer
there is also another way to do it
by using running total field and it evaluate section us the formula year(Order_Date)=2010
then to get total place the running field in report footer
to get sub-total make a new running field the same as the 1st but in the reset section check on reset of change of group and place this field in group footer
thnx