Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
krish2459
Creator
Creator

Barchart - Rolling 12 months

Hi,

I'm using the below logic to get rolling 12 months of data based on max datre selection.

 

But when I select a month the bar chart is shoing data for only one month insead of rolling 12 months.

 

Please check once.

 

if(Attributes='TOTAL EVENTS',

 

Count({<Month=, Year=,

[Postng Date]={">=$(=MonthStart(AddMonths(Max([Postng Date]),-12)))<$(=MonthEnd(Max([Postng Date])))"}>}distinct [Commercial DEFOA: ID]),


if(Attributes='SUPPLY CHAIN SECURITY ISSUE',

 

Count({<[Supply Chain Security Issue]={'Yes'}, Month=, Year=,
[Postng Date]={">=$(=MonthStart(AddMonths(Max([Postng Date]),-12)))<$(=MonthEnd(Max([Postng Date])))"}>} [Supply Chain Security Issue]),


if(Attributes='CORE PSCS', Count({<[Core PSCS]={'Yes'}, Month=, Year=,
[Postng Date]={">=$(=MonthStart(AddMonths(Max([Postng Date]),-12)))<$(=MonthEnd(Max([Postng Date])))"}>} [Core PSCS]),


if(Attributes='NCR', Count({<[NCR #]={'Yes'},Month=, Year=,
[Postng Date]={">=$(=MonthStart(AddMonths(Max([Postng Date]),-12)))<$(=MonthEnd(Max([Postng Date])))"}>} [NCR #])))))

 

Thanks,

Krish

Labels (1)
4 Replies
krish2459
Creator
Creator
Author

Hi,

 

Any suggestions please.

 

Thanks,

Krish

Kushal_Chawda

@krish2459  does it work properly without Month selection? Why have you written If condition here?

krish2459
Creator
Creator
Author

@Kushal_Chawda It is working proely with out Month year selection.

I have created four buttons for different attributes.

For that I have used If conditions.So based on selections the chart should work for rolling 12 months.

 

Thanks,

krish

Kushal_Chawda

@krish2459  As you are already given button for attributes. You can add "Select values in a field" actions for  field Attribute and Value for eg .  '=SUPPLY CHAIN SECURITY ISSUE'

Also, you can create one variable (Let's say vAttributeMeasure) . Add another action on Button as "set variable value" and assign Value for eg. '[Supply Chain Security Issue]'.

Above actions you can add on other buttons. Once this is done you can simply create single measure as follows which will work for all attribute

Count({<[Supply Chain Security Issue]={'Yes'}, Month=, Year=,
[Postng Date]={">=$(=MonthStart(AddMonths(Max([Postng Date]),-12)))<$(=MonthEnd(Max([Postng Date])))"}>} $(vAttributeMeasure))