Hi Team,
I have the bar chart with the below dimension and measure.
Dimension: CalendarMonth Format: MMM-YY
Expression: Sum(Miles)/Sum(NumofFailures)
Need to show the data for 12 months. that is from May-18 to Jun-17.
for some of the months the Sum(NumofFailures) may be zero, in that case we need to take the previous month Sum(NumofFailures).
If the previous month value of Sum(NumofFailures) also zero, in that case current month Sum(Miles) should be shown in the bar.
So, Here how to check each month value and previous month value.
Set analysis for this expression I am using here is :
Sum({<ear={">=$(=Year(AddMonths(Date#(Max(CalendarMonth),'MMM-YY'),-11))) <=$(=Year(Date#(Max(CalendarMonth),'MMM-YY')))"},
CalendarMonth={">=$(=Date(AddMonths(Date#(Max(CalendarMonth),'MMM-YY'),-11),'MMM-YY')) <=$(=Max(CalendarMonth))"}>}Miles)
/
Sum({<Year={">=$(=Year(AddMonths(Date#(Max(CalendarMonth),'MMM-YY'),-11))) <=$(=Year(Date#(Max(CalendarMonth),'MMM-YY')))"},
CalendarMonth={">=$(=Date(AddMonths(Date#(Max(CalendarMonth),'MMM-YY'),-11),'MMM-YY')) <=$(=Max(CalendarMonth))"}>}NumOfFailures)
Please help me.
Regards
Srinivas