Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
cgT
Creator
Creator

Expression Help

Hi experts,

I'm needing help with the following expression:

IF(
GetSelectedCount([Performance Date & Time]) = 1,
Sum(Tickets) / Sum(TOTAL <Venue, Show, PoH> Capacity),
IF(
GetSelectedCount([Performance Date & Time]) > 1,
Avg(Aggr(Sum(Tickets) / Sum(TOTAL <Venue, Show, PoH> Capacity), Venue, Show, PoH)),

Avg(Aggr(
IF(Count(Tickets) = 0, 0, Sum(Tickets) / Sum(TOTAL <Venue, Show, PoH> Capacity)),
Venue, Show, PoH, [Performance Date & Time]
))
)
)

My data model is based on performance sales data. So, if I have one performance selected, I want it to return the sold percentage compared to capacity, if more than one value is selected then the average of those selected, then if no value selected, then the average of of all performances in the data model even if they have zero tickets sold.

 

I though this would do it, but it doesn't work.

 

Help! And thank you...

Labels (3)
1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

It seems to me that the Avg expression would cover both the 1 selected and >1 selected cases. 

Avg(Aggr(Sum(Tickets) / Sum(TOTAL <Venue, Show, PoH> Capacity), Venue, Show, PoH))

Would it cover the 0 selection case as well?

-Rob