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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
pmmshc1
Contributor
Contributor

Calculate Percentage Based on Values in Different Rows

Hi

I  hope someone can help me with my query please? I am trying to calculate the percentage for the reason (hours/contract hours).

This is how the data is currently displayed:

pmmshc1_0-1627989350948.png

The issue is that the contract hours are on a separate line to the hours for the reason. 

I tried the following expression but it only works when a specific record is selected:

=Sum({<[ORIG]=,[ORIG]={AB}>} TOTAL HOURS)
/
Sum({<[ORIG]=,[ORIG]={BALANCE} >} TOTAL CONTRACT_HOURS)

It has worked out the percentage based on the overall total. 

When I filter on the reason, the percentage is not calculated.

I need the expression to calculate the percentage per month, per person, per reason even when all records are displayed. For example, the percentage should be as follows:

pmmshc1_1-1627989858342.png

Many thanks

0 Replies