Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
manu1512
Creator
Creator

Show last 13 months based on current month

Hi all,

i had a field reportmonth which has value like 2018-01,2018-02.

 

It is in text value .

i want to show use this as as dimension as chart. but in dimension i want to show only last 13 months date.

 

Can any one suggest me what to do ....it seems my logic is not working

 

Kind Regards

 

Labels (1)
  • logic

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

The first step is to get proper dates from the text string - in the load script, when you load reportmonth, replace reportmonth with the line:

LOAD
...
Date#(reportmonth, 'yyyy-MM') as reportmonth,

Now you can use all the Date functions.  For 13 months, you could use the set expression like this:

Sum({<reportmonth = {">=$(=Date(Addmonths(Max(reportmonth), -12),'yyyy-MM')) <=$(=Date(Max(reportmonth),'yyyy-MM'))"}> amount)

Adjust the expression to suit your requirements.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
manu1512
Creator
Creator
Author

Hi Jontydkpi,

 

Thanks for reply.

 

Can you please tell me how to limit the last 13 months as calaculated dimension ,it can be a great help