Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count of Max Weekday Sales

   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:

WeekWeekdaySales
36Monday1000
36Tuesday500
36Wednesday800
36Thursday400
36Friday600
37Monday1500
37Tuesday800
37Wednesday700
37Thursday500
37Friday600
38Monday800
38Tuesday2000
38Wednesday1500
38Thursday800
38Friday600

So the result of this table is:

WeekWeekDay with the maximun Sales
36Monday
37Monday
38Tuesday

What I want to get is the number (count) of every Weekday in which it has got the maximun value.

WeekdayCount
Monday2
Tuesday1

Thanks in advance

1 Solution

Accepted Solutions
d_pranskus
Partner - Creator III
Partner - Creator III

Hi

Please take a look at the application attached.

Darius

View solution in original post

7 Replies
d_pranskus
Partner - Creator III
Partner - Creator III

Hi

Please take a look at the application attached.

Darius

jagan
Luminary Alumni
Luminary Alumni

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.

Anonymous
Not applicable
Author

Hi Darius, I haven't seen any file attached. Could you please try again?

Thank you

Anonymous
Not applicable
Author

Sorry I was mistaken. I'll take a look!

Thanks

jyothish8807
Master II
Master II


Hi Pitutiti,

Try this:

In Dimension:

Week

In expression:

=firstsortedvalue(Weekday,-Sales)

Yoe will get your first table.

Regards

KC

Best Regards,
KC
Anonymous
Not applicable
Author

Darius, your suggestion works pretty good for me.Thanks a lot you all for you time!!

jyothish8807
Master II
Master II

Hi Pituti,

PFA

Regards

KC

Best Regards,
KC