Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Brunommsilva
Contributor
Contributor

Aggregation expression difficulties

Hello, 

Been struggling to replicate an expression that the costumer needs. Excel attached. 

I need an expression to get the YTD value (which is the 87% in the orange cell) on a Pivot table where none of the relevant fields exist as Dimension except for Name and Product, which can be collapsed. I've tried innumerous combinations of Aggr expressions, but  nothing seems to be working. 

I would be very grateful if someone has a solution for this. 

The Excel is attached. I'm not pasting the data here as it would be confusing to read. 

Thanks in advanced!.

Bruno. 

 

Labels (1)
1 Solution

Accepted Solutions
justISO
Specialist
Specialist

Hi, it depends on how you get this 'example' data table, but from it you can get this 87,3% with formula:

sum(aggr( ((Sum([SALES MONTHLY])/Sum([TARGETS MONTHLY]))*[PROD WEIGHT])*(count([PROD WEIGHT]) / 7) ,[PRODUCT NAME],[PROD WEIGHT]))

where I'm not sure what this 'tYTD=7' means, so I added it by hand, but it can be replaced with measure, like count(total distinct DATAMONTH) or something else.

justISO_0-1665384177933.png

View solution in original post

2 Replies
justISO
Specialist
Specialist

Hi, it depends on how you get this 'example' data table, but from it you can get this 87,3% with formula:

sum(aggr( ((Sum([SALES MONTHLY])/Sum([TARGETS MONTHLY]))*[PROD WEIGHT])*(count([PROD WEIGHT]) / 7) ,[PRODUCT NAME],[PROD WEIGHT]))

where I'm not sure what this 'tYTD=7' means, so I added it by hand, but it can be replaced with measure, like count(total distinct DATAMONTH) or something else.

justISO_0-1665384177933.png

Brunommsilva
Contributor
Contributor
Author

Hi, Thank you very much. 

You don't even imagine how many variations of this expression I tried. I was very close to it, but I guess I started running in circles. 

Thanks once again! 

Best Regards,

Bruno Silva.