Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

read list of dimensions used in a pivot table

Hello

got a pivot table in which dimensions are conditionally enabled/ disabled

I have an expression that needs to be aggregated first by date then by the enabled dimensions

so I want to write something like:

sum(aggr( my_expression, date,enabled_dim1, enabled_dim2, etc...))


kindly advise on how to accomplish this

I can walk on water when it freezes
4 Replies
avkeep01
Partner - Specialist
Partner - Specialist

Hi Ali,

I'm not sure if I understand you correctly. Are you able to attach an example?

Should the dimensions be dynamically used in the aggregation? so based on your selections different dimensions should be enabled?

tresesco
MVP
MVP

You could use the same conditions to decide on the dimensions in the aggr(), like:

Sum(Aggr(Sum(Value),$(=Pick(match(vDimEnable,1,2), 'Dim1', 'Dim2'))))

ali_hijazi
Partner - Master II
Partner - Master II
Author

yes this is the case

I can walk on water when it freezes
avkeep01
Partner - Specialist
Partner - Specialist

Then you could use a variable that concats the possibilities:

vDim =

CONCAT(DISTINCT Dim_Selection,',')

And in your aggregate:

sum(aggr( SUM(my_expression_field), $(=vDim)))


By using $(= the value of the dimension is used, an that is a list of dimensions.


If you only need one enabled dimension then look at what tresesco‌ recommends.