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

Dividend with different ganularity levels

Hello there:

I have a Fact table with different leves of granularity, I need the result of [Unit Cost] divided by [Services] As shown in the next image:

Img01.png

I need the total of services to be a constant for all products and families accordig with Embarcacion and YearMonth, so I used the next formula:

=sum (TOTAL <YearMonth ,Embarcacion ,Service> Services)

In the result I get the divisor, but when I select a Family or Product, the Divisor desappear:

Img02.png

So I tried with the next formula:

=sum (TOTAL <YearMonth ,Embarcacion ,Service> {<Family=,Product=>} Services)

Img03.png

So when I select a Family or Product, the divisor Still same as I need, but shows all data as follow:

Img04.png

How can I keep the divisor value and respect the selection of product or family wich have different levels of granularity?

I attach the QV document, any help will be greatful.

Thanks in advance.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe like

=sum(aggr(sum ({<Family=,Product=>} Services),YearMonth,Embarcacion,Service))

But you shouldn't see any issues with the existing expression when you use it as denomnator .

edit: Changed to outer sum() aggregation

View solution in original post

2 Replies
swuehl
MVP
MVP

Maybe like

=sum(aggr(sum ({<Family=,Product=>} Services),YearMonth,Embarcacion,Service))

But you shouldn't see any issues with the existing expression when you use it as denomnator .

edit: Changed to outer sum() aggregation

Not applicable
Author

Thank you for your quik response swuehl, it works, I just make a little adjusments for my own dashboard.