Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rolandg1881
Creator
Creator

Last 3/6/12 months from NOW

Hi!

I searched for a solution but was not able to solve my problem.

I have a qlikview Report with revenues and i want to se the revenue for example: products , last 6 months revenue

Now i have this in a Formula for the summary of revenues:

sum({<[ArtikelTyp_name]={'Engine'},Date={'>$(=AddMonths(Max(Date),-12))'}>}[Rechnungsmenge])

also tryied

sum({<[ArtikelTyp_name]={'Light-Engine'},Date={'>$(=AddMonths(Today(),-5))'}>}[Rechnungsmenge])

If i change the Year from example 2021 and 2020 the result also changes but i want see the last 12 months from today regardless of selected year.

I tryied different things date(today) etc. but it wont work. I think "Date" is the problem?

Has anybody ideas whats wrong or whats the correct formular?

Thank you very much.

Labels (1)
3 Replies
edwin
Master II
Master II

you can explore the as of table

The As-Of Table - Qlik Community - 1466130

however, my preference is to build a bridge between the fact and the calendar where you associate each date in the calendar to the set of dates in your fact that represents the period you are interested in.  for example, each date in the current month will be associated to all the dates in your fact that encompasses the current and prior two months and assign an attribute to this association (say period equal to 'last 3 months').  this way when a single date in Jan 2021 is selected and the period selected is 'last 3 month', Jan 2021, Dec 2020, ad Nov 2020 are possible selections.  obviously you don't force the user to select period but you do that in your set analysis modifiers.  then its just a simple 

this way you don't burden the UI with complex expressions specially when you need to combine multiple periods in the same chart.

edwin
Master II
Master II

=sum({<Period={'Last 3 months'}>}measure)

edwin
Master II
Master II

had to separate the code as for some reason its not being accepted.  this will be the pattern for your expressions