Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
vipingarg23
Creator
Creator

How to calculate sum for quarterly basis

Hi Team,

Please find the dummy data as an attachment.

Requirement:


I have one dimension YearQuarter and two expression A1 and B1.

I want to calculate B1 expression in such a way that it should sum the data of A1 for 2016Q1, 2016Q2, 2016Q3, 2016Q4 and same for 2017 Quarter data. I want the B1 data as below:

YearQuarter2016Q12016Q22016Q32016Q42017Q12017Q22017Q32017Q4
A1579134182022
B13464


Please find the dummy data as an attachment. Can anybody give me the solution?


Thanks for your help!!!!!!!!!

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try this:

If(Right(YearQuarter,1)='4', RangeSum(Before(Sum(Data), 0,4)))

Capture.JPG

View solution in original post

3 Replies
fvelascog72
Partner - Specialist
Partner - Specialist

Hi,

Create a Year Field: Left(YearQuarter,4) as Year

Then in the expression use:

If(Right(YearQuarter,2)='Q4', Before(Sum(Aggr(Sum(Data), Year)), 3,1))

Saludos

tresesco
MVP
MVP

Try this:

If(Right(YearQuarter,1)='4', RangeSum(Before(Sum(Data), 0,4)))

Capture.JPG

vipingarg23
Creator
Creator
Author

Thanks for your help..

It is working fine.