Skip to main content
Sept. 27, 10AM ET Do more with Qlik, Insight Advisor – our intelligent AI-assistant in Qlik Sense: Register
Showing results for 
Search instead for 
Did you mean: 
Creator III
Creator III

Max Month Expression based on Selection

I have the following expression in a gauge chart that works perfectly when no Month selection is made :

MonthNumber ={"$(=max(MonthNumber))"},
Daily_Working_Hours = {">0"},
Total_Working_Hours = {">20"}


Measure = {'InitialDate'},
Total_Working_Hours = {">20"}
>}Distinct SERIAL#)

However when any month is selected other than the initial month the expression breaks and returns the wrong answer.  I cant figure out where its falling over.

Maybe expression should consider the range of months available?  IE MonthNo >min(MonthNo) < Max(MonthNo)?

Labels (1)
3 Replies

What exactly do you mean when you say wrong result? Would you be able to share a sample where we can see the issue?


You will need to explain what's not working as expected.

A tip is to temporary break your expression in two to check which part is returning the wrong figures.

Your current first part of your expression is calculating of the latest month in your selection. So if you select a month then this will be reflected in your expression as well. If you select multiple months then it will only calculate for the latest in that section. 

Creator III
Creator III

Thanks for replies both.  So with no month selected the chart resolves to show result for Sep and this is correct.  If I isolate a single month the result will be incorrect, say I select Jul-2020 I get this error, however selecting Jan-2019 through to Jul-2020 I then get the correct result. 

I'm trying to have the chart display the maximum month selected, and if no selection made then current month.