Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have the following scripts and dataset as follow and now i need to find the quarter difference for the same customer.
can anyone advise me how to get the quarter difference and what should i add on?
How is the "the quarter difference" defined for a given customer?
When looking at your sample table, a Customer can show multiple records, so what is "the difference" in these cases?
Also, what about a date range spanning multiple years, how do you want to handle this?
If possible, post some sample records and your requested result.
And last, have you had a look at my last reply to your other thread?
It seems to me that you are basically posting multiple times the same request, which is not a good idea, since it makes it hard to follow the discussion and further clutters the forum with duplicate topics.
Regards,
Stefan
Try This:
in script add:
dual(year(OrderDate)&'Q'&Ceil(Month(OrderDate)/3),QuarterStart(OrderDate))as MyQuarter,
Create straight table:
Dimension as Customer
Expression as
Curr Q Sales =Sum(Sales)
Pre Q Sales = Sum({1<MyQuarter={"$(=dual(year(max(OrderDate))&'Q'&Ceil((Month(max(OrderDate))/3)-1),QuarterStart(max(OrderDate))))"}>}Sales)
What do you mean by "quarter difference" here?
Like q3 - Q1= 2q.
The 2q is quarter difference
Sent from Outlook Mobile<https://aka.ms/blhgte>
Try using below expression
Curr Q Sales =Sum(Sales)
Pre Q Sales = Sum({1<MyQuarter={"$(=dual(year(max(OrderDate))&'Q'&Ceil((Month(max(OrderDate))/3)-1),QuarterStart(max(OrderDate))))"}>}Sales)
Tab:
LOAD * INLINE [
ScreeningQtr, Customer
Q3, A
Q3, B
Q3, C
Q3, D
Q3, E
Q3, F
Q3, A
Q2, B
Q1, C
Q2, D
Q1, E
Q1, F
Q1, A
Q1, B
Q2, C
] ;
Load *, If(Previous(Customer) = Customer ,right(ScreeningQtr,1)-Right(Previous(ScreeningQtr),1), right(ScreeningQtr,1)) As QtrNo
Resident Tab Order by Customer, ScreeningQtr asc;
Drop Table Tab;
HI,
I cannot define another inline using customers as the customer list is too many and will grow over the time.
i have tried to identify the diff between the same customer.
However, the below script failed. anyone can advise, pls?
Data:
Load
*,
if(previous([Customer]) = [Customer], ceil((ScreeningQtr - Previous(ScreeningQtr)))) As Diff;
Load
*
Resident Table2
Order by [Customer], ScreeningQtr;
Drop Table Table2;
can't work.
i need to find the quarter difference for the same customer.
for example Customer A - Q3 and Customer A - Q7
the quarter difference for Customer A shall be 4.
Able to advise, pls.