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: 
Not applicable

Problem with rolling months on total

Hi all,

I need to calculate a market share for a group of products for each month and I'm using a formula like this:

=Sum({<year=,PeriodDate={">=$(=AddMonths(Max(PeriodDate),-12)) <=$(=Max(PeriodDate))"}>} CValue)

/

Sum( total <PeriodDate> CValue)

I have two dimensions, PeriodDate + the group of products, that's why I need the the total part.

The problem is on the underlined part: I'd need it to have the total for each month but it keeps showing me the total only for the last month.

Do you guys have any suggestion? That would be much appreciated.

Thanks for your help,

Lucia

1 Solution

Accepted Solutions
cesaraccardi
Specialist
Specialist

Hi Lucia,

What if you copy the set analysis expression to the total calculation:

=Sum({<year=,PeriodDate={">=$(=AddMonths(Max(PeriodDate),-12)) <=$(=Max(PeriodDate))"}>} CValue)

/

Sum( total <PeriodDate> {<year=,PeriodDate={">=$(=AddMonths(Max(PeriodDate),-12)) <=$(=Max(PeriodDate))"}>}CValue)

View solution in original post

3 Replies
cesaraccardi
Specialist
Specialist

Hi Lucia,

What if you copy the set analysis expression to the total calculation:

=Sum({<year=,PeriodDate={">=$(=AddMonths(Max(PeriodDate),-12)) <=$(=Max(PeriodDate))"}>} CValue)

/

Sum( total <PeriodDate> {<year=,PeriodDate={">=$(=AddMonths(Max(PeriodDate),-12)) <=$(=Max(PeriodDate))"}>}CValue)

ramoncova06
Partner - Specialist III
Partner - Specialist III

The total qualifier only gives you the selected month, could your issue be related to that ?

the following post give more details into using total The Aggregation Scope

Not applicable
Author

Thank you Cesar,

this was exactly the problem!