Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Display Last Three Months

The current equation below works to display max load date:

LOAD_DATE = {"$(=Date(Max(LOAD_DATE), 'YYYY/M'))"}

However, I would like the chart to display last 3 months. I tried below but this did not work.

LOAD_DATE = {"$(=Date(Max(LOAD_DATE) - 2, 'YYYY/M'))"}

Any suggestions?

Thank you,

- dave

13 Replies
sunny_talwar

Try this:


LOAD_DATE = {">=$(=Date(AddMonths(Max(LOAD_DATE), - 2), 'YYYY/M'))"}

Anonymous
Not applicable
Author

Sunindia  - This helps, but I need the previous months to stay displayed even when the user picks a specific month.

For example, I have month options at the top of the application: Jan, Feb, Mar

When user clicks Mar, I want them to be able to see Mar, and the two previous months.

Hope this makes sense

sunny_talwar

What is the name of the dimension you are using for Month?

Anonymous
Not applicable
Author

BL_Month

sunny_talwar

See if this helps:

Try this:


{<LOAD_DATE = {">=$(=Date(AddMonths(Max(LOAD_DATE), - 2), 'YYYY/M'))"}, BL_Month = >}

Anonymous
Not applicable
Author

That did not seem to work. No data was displayed. Whole expression is below.

count({<

Field1={'Value1'},

Field2= {'Value2'},

LOAD_DATE = {">=$(=Date(AddMonths(Max(LOAD_DATE), - 2), 'YYYY/M'))"}>}

Line_ID)

sunny_talwar

Would you be able to share a sample?

Anonymous
Not applicable
Author

Unfortunately I cannot. But thank you for your help this far

sunny_talwar

So when you use this expression:

Count({<Field1={'Value1'}, Field2= {'Value2'}, LOAD_DATE = {">=$(=Date(AddMonths(Max(LOAD_DATE), - 2), 'YYYY/M'))"}, BL_Month = >} Line_ID)

you see no results?

but this works?

Count({<Field1={'Value1'}, Field2= {'Value2'}, LOAD_DATE = {">=$(=Date(AddMonths(Max(LOAD_DATE), - 2), 'YYYY/M'))"}>} Line_ID)


Is this what is happening?