Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
btrompetter
Contributor III
Contributor III

Aggregation with variable Periods

Hello,

I have the following diagramm

error loading image

It shows the average gross sales depending on the selected period. The period could be day, week and month. I can create three diagramms for every period. But I don't like it. So is it possible to make an aggr function wich use a variable for the period?

Something like this:

aggr( sum(Sales / count(AD_ID_COUNT)), Year, $(=vPeriod) )

but this didn't work.

Do you have any solution for this problem?

Thanks for help.

regards

Bastian

3 Replies
tabletuner
Creator III
Creator III

Did anyone ever found an answer to this? I also cant get it working!

Regards,

Tjeerd

Not applicable

Hi Tjeerd,

To take a better look I need a testapp. But in the original topic I would skip the '=' in $(=vPeriod).

The rest looks right to me.

Groeten,

Halmar

tabletuner
Creator III
Creator III

Thanks for your answer Mr. Heijnen. However, it seems to me that it isn't allowed to use expressions in an aggregation function. The manual says:

" Each dimension must be a single field. It may not be an expression (calculated dimension)."

A walkaround would be to create a variable and use the function

if(getselectedcount(week),week,

if(getselectedcount(month),month,

year)))

Create 3 charts with different periods but that have exactly the same layout. Use the variable in a conditional show to show the right chart to the user.