Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
richard24best
Creator II
Creator II

Aggregate sum of quarter months and variance in Qliksense table

Hi Team,

I have a requirement where we can collating Client metrics (combination of numbers and percentage) monthly.

But i want to show Monthly values based on Month selection and Aggregated quarterly (sum of monthly values for that quarter and average percentage of the quarter) when Quarter is selected by the user.

Could you please help me out how to write expression to get this?

1) Month wise

2) Quarterly aggregate sum and average of percentage (Quarter - Jan, Feb, Mar)

3) Quarterly variance

sample table attached

Labels (3)
1 Solution

Accepted Solutions
richard24best
Creator II
Creator II
Author

Thanks @Daniel_Castella  and @Chanty4u  for your time and support.

Well, i have figured out self :). Sharing expression for latest quarter values

If(Only([Metric Type])='Percentage',
Num(Avg({<YearQuarter_Sort={"$(=if(GetSelectedCount(YearQuarter)=0 and GetSelectedCount(Month)=0,Max(Total YearQuarter_Sort)=1,Max(YearQuarter_Sort)))"}>}Quarter_Value),'0.0%'),
Num(Sum({<YearQuarter_Sort={"$(=if(GetSelectedCount(YearQuarter)=0 and GetSelectedCount(Month)=0,Max(Total YearQuarter_Sort)=1,Max(YearQuarter_Sort)))"}>}Quarter_Value),'#,##0'))

View solution in original post

3 Replies
Daniel_Castella
Support
Support

Hi @richard24best 

 

I would like to help you on this request, but I'm not understanding your data sample. Is this the data you are expecting to have or is it the raw data?

-In the first case, could you, please provide a sample of row data in order I can implement the calculations?

-In the second case, could you, please, indicate how are you obtaining this data, specially the percentages, and which are the results you expect?

 

Also, could you, please, clarify which Qlik object do you want to use and if the Monthly and Quarterly data need to be displayed together?

 

Thank you very much

Daniel

Chanty4u
MVP
MVP

Try this for sum you can try for AVG in place of sum and then difference 

Sum(

  Aggr(

    Sum(ValueMetric),

    Year,

    Quarter,

    Month

  )

)

richard24best
Creator II
Creator II
Author

Thanks @Daniel_Castella  and @Chanty4u  for your time and support.

Well, i have figured out self :). Sharing expression for latest quarter values

If(Only([Metric Type])='Percentage',
Num(Avg({<YearQuarter_Sort={"$(=if(GetSelectedCount(YearQuarter)=0 and GetSelectedCount(Month)=0,Max(Total YearQuarter_Sort)=1,Max(YearQuarter_Sort)))"}>}Quarter_Value),'0.0%'),
Num(Sum({<YearQuarter_Sort={"$(=if(GetSelectedCount(YearQuarter)=0 and GetSelectedCount(Month)=0,Max(Total YearQuarter_Sort)=1,Max(YearQuarter_Sort)))"}>}Quarter_Value),'#,##0'))