Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
konidena
Creator
Creator

how to take the each month into consideration when showing data for 12 months in bar chart

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

0 Replies