Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
karthikeyan1504
Creator III
Creator III

How to get max of month year?

Hi,

I have a date field in the main table. I have derived the month year from the main table using the default master calendar script.

Now I need to get the latest month-year for my set analysis expressions.

Could anyone please advise me to get the latest month-year?

Thanks & Regards,

Karthikeyan.

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

you can simply use the below set analysis expression for this,

=Sum({<Year=, Month=, Date={'>=$(=MonthStart(Max(Date)))<=$(=MonthEnd(Max(Date)))'}>} Sales)

Hope this helps you.

Regards,

Jagan.

View solution in original post

18 Replies
Anonymous
Not applicable

How you have created MonthYear?

like this? 


MonthName(Date) as MonthYear?

Did you try with max(MonthYear)?

petter
Partner - Champion III
Partner - Champion III

Sum( {< MonthYear = { '$(=Max(MonthYear)' } > } SomeMeasure )

avinashelite

if you want the latest date according to you data then try MAX(date_filed) or if you want the latest month year then

monthname(today()) as latest_month

karthikeyan1504
Creator III
Creator III
Author

It doesn't work

karthikeyan1504
Creator III
Creator III
Author

I have the latest month year in my data is jan 2016.

Somehow I need to fix my set analysis to my latest month year(jan 2016) of the data I load.

Anonymous
Not applicable

sample data?

karthikeyan1504
Creator III
Creator III
Author

Month Year Month_row
Apr-1510
May-154
Jun-155
Jul-156
Aug-159
Sep-151
Oct-152
Nov-153
Dec-158
Jan-167

In above table, I am trying to get the row number to each month year, so that I can easily fix the max(Month_row) in set analysis, but the issue is in sorting.

petter
Partner - Champion III
Partner - Champion III

If you haven't already a combined Month and Year field in your data model you could do this:

Sum( {< MonthYear = { '$(=Max([Month Year])' } > } SomeMeasure )


I have presumed that your [Month Year] field really is an actual data field in QlikView... isn't that so?

Anonymous
Not applicable

Working same in my case, see the attachment

Also , you can try like this?

monthname(max(DateField))     in your set analysis