Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, hope somebody can help me. I would like to know how can I set the analysis expression in order to achieve the following:
I want to know the number of every day of the week in which the sales are the maximun value within the week and between a period, e.g. two months
Let's say we have the following data:
| Week | Weekday | Sales |
|---|---|---|
| 36 | Monday | 1000 |
| 36 | Tuesday | 500 |
| 36 | Wednesday | 800 |
| 36 | Thursday | 400 |
| 36 | Friday | 600 |
| 37 | Monday | 1500 |
| 37 | Tuesday | 800 |
| 37 | Wednesday | 700 |
| 37 | Thursday | 500 |
| 37 | Friday | 600 |
| 38 | Monday | 800 |
| 38 | Tuesday | 2000 |
| 38 | Wednesday | 1500 |
| 38 | Thursday | 800 |
| 38 | Friday | 600 |
So the result of this table is:
| Week | WeekDay with the maximun Sales |
|---|---|
| 36 | Monday |
| 37 | Monday |
| 38 | Tuesday |
What I want to get is the number (count) of every Weekday in which it has got the maximun value.
| Weekday | Count |
|---|---|
| Monday | 2 |
| Tuesday | 1 |
Thanks in advance
Hi
Please take a look at the application attached.
Darius
Hi,
Try like this in script, then it would be easier in frontend
Data:
LOAD
*,
If(Peek('Week') <> Week, 1, 0) AS MaxFlag
RESIDENT DataTemp
ORDER BY Week, Sales Desc;
For Table1:
Dimension : Week
Expression: Only{<MaxFlag={1}>} Weekday)
For Table2:
Dimension : Weekday
Expression: Count{<MaxFlag={1}>} Weekday)
Hope this helps you.
Regards,
Jagan.
Hi Darius, I haven't seen any file attached. Could you please try again?
Thank you
Sorry I was mistaken. I'll take a look!
Thanks
Hi Pitutiti,
Try this:
In Dimension:
Week
In expression:
=firstsortedvalue(Weekday,-Sales)
Yoe will get your first table.
Regards
KC
Darius, your suggestion works pretty good for me.Thanks a lot you all for you time!!
Hi Pituti,
PFA
Regards
KC