Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
BartHeijne
Partner - Contributor
Partner - Contributor

How to create an expression disregarding a certain dimension

The data is like this
PART, SUBPART, Quantity
A, B, 11
A, C, 55
A, D, 22

Now I want to calculate the field Quantity divided by the number on subpart B
So the outcome should be

PART, SUBPART, Number, newexpression
A, B, 11
A, C, 55, 5 (calculated as 55 / 11)
A, D, 22, 2 (calculated as 22 , 11)

What should the newexpression look like
I have tried something like SUM(Quantity) / SUM(AGGR(SUM({<SUBPART={'B'}>}Quantity), TOTAL PART))
But the outcome is '-' for every line

Labels (1)
1 Solution

Accepted Solutions
Daniel_Castella
Support
Support

Hi @BartHeijne 

 

For the data displayed above, this formula is enough:

If(SUBPART<>'B', sum(Quantity)/sum(Total {<SUBPART={'B'}>} Quantity))

 

However, if your dataset is more complex, maybe it needs to be adjusted.

 

Kind Regards

Daniel

View solution in original post

1 Reply
Daniel_Castella
Support
Support

Hi @BartHeijne 

 

For the data displayed above, this formula is enough:

If(SUBPART<>'B', sum(Quantity)/sum(Total {<SUBPART={'B'}>} Quantity))

 

However, if your dataset is more complex, maybe it needs to be adjusted.

 

Kind Regards

Daniel