Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to create bar graph for "Rolling 12 months data excluding current ongoing month?

Hello All,

I am trying to create bar graph for "Rolling 12 months data excluding current ongoing month" and i have an expression set in master item but the output includes data from current month also. Below is the expression -

COUNT(

{

1<[Created On Dt]={'>=$(=Monthstart(Addmonths(Max([Created On Dt]),-12)))<=$(=Max([Created On Dt]))'}>

}

IF(ISNULL(Id),0,1)

)

P.S. - I am completely new in this Qlik sense world! Any help with simple explanation will be appreciated.

4 Replies
william_fu
Creator II
Creator II

So Max([Created On Dt]) will always give you the latest date in your data (which I assume is equivalent to the current month)

Using MonthEnd(Max([Created On Dt]),-1) means you're calculating up to the last day of the month before the current one.


e.g.:

Max([Created On Dt]) = 15/08/2018

MonthEnd(Max([Created On Dt]),-1) = 31/07/2018


COUNT(

{

1<[Created On Dt]={'>=$(=Monthstart(Addmonths(Max([Created On Dt]),-12)))<=$(=Monthend(Max([Created On Dt]),-1))'}>

}

IF(ISNULL(Id),0,1)

)

zebhashmi
Specialist
Specialist

why you are using count

I think if you want to make a graph your dim would be something like William explained

only({1<[Created On Dt]={'>=$(=Monthstart(Addmonths(Max([Created On Dt]),-12)))<=$(=Monthend(Max([Created On Dt]),-1))'}>}Created On Dt)

Anonymous
Not applicable
Author

Thank you William, it worked!

But then i tried to change colors in stacked bar graph and then x-axis is showing me extra data points which is not required.12 months data.PNG.

Can you please help?

Anonymous
Not applicable
Author

Any help please?