Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
chriscools
Creator II
Creator II

how to show only last month data and not the whole year if no month is selected

Hello,

i have a tabel to compare sales of this month, last month, and this month last year.

but if i don't choose a month, than it gives me the sales for the total year.

how would i have to do it that if no month is selected only last month is chosen?

this is the formula i have

Sum({<Shop= {'Pomax Store Wijnegem'}, Year = {$(= Max(Year))}>}LineSalesAmount

and i tried this: (in analogy with the max year)

Sum({<Shop= {'Pomax Store Wijnegem'}, Year = {$(= Max(Year))} Month= {$(=Max(Year))}>}LineSalesAmount

but then i don't get my calculation at all!

what am i doing wrong?

thanx!

chris

12 Replies
chriscools
Creator II
Creator II
Author

Thank you very much!

this works! could you perhaps tell me what i was doint wrong, or why this is working?

thanx!

chris

chriscools
Creator II
Creator II
Author

Hello,

why do you ask about the MonthYearField? i have it in the calendar.

would it be better to use that , and if so why?

grtz

chematos
Specialist II
Specialist II

Hi, you're welcome!

I'm not sure but I think that using max function, QV doesn´t asociate the number got with max() to field Month, so I use month(max(Date)) to get the month name.

Also, I saw that selecting a MonthYear, the selection didn´t get values for your table, but as you can see, in the expression we are using two fields to select a year and a month, that's why I wanted to use MonthYear instead using two fileds for the same selection.

Regards