Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
qohardwi
Partner - Contributor
Partner - Contributor

Show only last 12 months

Hey i want to show only last 12 month with condition acumulation,

Here my sintax :

Aggr (
if(StatsNo2='1', count({<mtd_1239 = {"Annual General Meeting"},
DATEPERIOD = {">=$(=min({1}[DATEPERIOD]))<=$(=max([DATEPERIOD]))"} >} 
                distinct er_1239),0), YearMonth)
 
What i should do ?

Thank you

qohardwi_1-1695196186159.png

 

 

Labels (3)
3 Replies
MayilVahanan

Hi

Try like below

count({<mtd_1239 = {"Annual General Meeting"},
DATEPERIOD = {">=$(=MonthStart(max([DATEPERIOD]),-11))<=$(=max([DATEPERIOD]))"} , YearMonth=Month=,Year=, StatsNo2={1}>} 
                distinct er_1239)
Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
qohardwi
Partner - Contributor
Partner - Contributor
Author

Hi i think you missed my point ,

i want to calculate only last 12 months but if i follow your latest syntax it's only accumulate from last 12 months from the periods, but what i want is to accumulate started from the data beginning but i only choose last 12 months

qohardwi_0-1695281554396.png
The expected result should be (Jan 2023 - Jan 2022) but the data should accumulate all of the data when started (The data started Apr 2020) so from my calculate value in Jan 2022 should be : 1.374

qohardwi_1-1695281875742.png

 

 

MayilVahanan

HI

For this kind of scenario, you can try 2 things.

1. Store the values from starting (Apr 2020) to before display month (Dec 2021) in the variable and use in the chart along with ur last 12 months expression. ex: 1.368 value is stored in the variable .. hope it will give some idea to achieve it.

2. Else, you can calculate the accumulation in the script level itself and display in the front end. In script level, you need to use group by including the filters available in the front end to change dynamically. little bit tricky. 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.