Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
aaronnayan
Creator III
Creator III

Sales for the largest month expression

Hi Guys

I want to create a variable,

Is there a way for me to calculate the month with the largest sales

Mont field is "DEC_Month"

Sales field is "SALES"

N.B .  It should only show one month

16 Replies
Anil_Babu_Samineni

This?

FirstSortedValue(DEC_Month, -Max(SALES))

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
aaronnayan
Creator III
Creator III
Author

No sorry anil that doesnt work

Anil_Babu_Samineni

My Bad, Should work

FirstSortedValue(DEC_Month, -Aggr(Max(SALES), DEC_Month))

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
tresesco
MVP
MVP

Try like:

FirstSortedValue(DEC_Month, -Aggr(Max(SALES),DEC_Month))

aaronnayan
Creator III
Creator III
Author

Hi Anil

If i was to save your expression

I would create a variable  

FirstSortedValue(DEC_Month, -Max(SALES))>>>  vTopMonth

Then in my chart i would use this

Sum({1<DEC_Month={'$(vTopMonth)'}>}SALES)

If you see errors please tell me

Kind Regards

Anil_Babu_Samineni

Use this in variable

FirstSortedValue(DEC_Month, -Aggr(Max(SALES), DEC_Month))

Then, Set analysis should be this?

Sum({1<DEC_Month = {"$(=$(vTopMonth))"}>} SALES)

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
aaronnayan
Creator III
Creator III
Author

Very Very close its giving a result,

but its not selecting the largest month 😮

Its selecting the middle month if that helps

I have 3 months and its selecting the middle one, not the lowest or the highest.

Could it be the varible?

tresesco
MVP
MVP

You could even directly try like:

Sum({1<DEC_Month={"=DEC_Month=Max(total SALES)"}>}SALES)

Anil_Babu_Samineni

Check testing in text object and tell me whether you are getting any thing or not?


=vTopMonth

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)