3 Replies Latest reply: Jul 22, 2013 12:23 PM by Sabahath Khan

# Need help with Quarter Calculations

Hi,

I am new to Qlikview and learning the ropes. I am kind of stumped on this issue and was hoping someone can help me out.

I have a scenario where i Have a table with patients, disease and date. The requirement is to display count of patients in a bar chart by disease as a stacked bar by Quarter Year for current and last 3 quarters based on year and month selected.

The issue is i have created a master calendar and was able to get quarter year and was able to get last 3 quarter values using the following expression

Count({<YearQuarterID= {"<=\$(=max(YearQuarterID)) >\$(=max(YearQuarterID)-4) "}, Year=, Month=, Date=>} [Patient ID])

Now i was informed I need not aggreate the months values in a QTR but display the values for the last month in each quarter. So if some one selects Year = 2013, Month = Feb. The chart should display Q1 13 with Feb count value as one bar followed by Q4 12 with Dec 12 count value and so on...

Anyone have any ideas how we can do this? Or get the count of the last month of the quarter in which the month selected falls in?

• ###### Re: Need help with Quarter Calculations

this?

Count({<YearQuarterID= {\$(=max(YearQuarterID)}, Year=, Month=, Date=>} [Patient ID])

• ###### Re: Need help with Quarter Calculations

No sorry, when i try that all i get is no data to display.

• ###### Re: Need help with Quarter Calculations

So with the help of jagan mohan's previous post  i was able to write an expression to get the max month value in a quarter

=sum(Aggr(If(Max(TOTAL<YearQuarter, Disease> YearMonthID) = YearMonthID, Count([Patient ID])), YearQuarter, Disease YearMonthID))

now is there a way i can display last 3 quarters values?