Skip to main content

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

cancel
Showing results for 
Search instead for 
Did you mean: 
renjithpl
Specialist
Specialist

Adding row values

Hi All,

I have an output table like below:

row cost center unit_type Source Amnt
1 posAA Del Cash 50
2 posAA Del Hours 20
3 posAA Del Rates 2.5
4 posAA Area Cash 300
5 posAA Area Hours 100
6 posAA Area Rates 3
1 posAA Operations Cash 50
2 posAA Operations Hours 20
3 posAA Operations Rates 2.5
4 posAA Operations Cash 300
5 posAA Operations Hours 100
6 posAA Operations Rates 3

 

I am expecting an output like below 

cost center unit_type Source Amnt
posAA Del Cash 50
posAA Del Hours 20
posAA Del Rates 2.5
posAA Area Cash 300
posAA Area Hours 100
posAA Area Rates 3
posAA Operations Cash 350
posAA Operations Hours 120
posAA Operations Rates 2.916667

 

but unfortunately I am getting a wrong output for Operations and Rates = 5.5.
its Summing Del and Area Rates (2.5 + 3) = 5.5 which is wrong. 

Basically, I want to add the total of Del and Area Cash (50 + 300) =350  / Del and Area Hours (20 + 100) = 120 and the result should be 2.91 not 5.5

renjithpl_0-1637833668148.png

Thanks in Advance.

Renji

1 Reply
renjithpl
Specialist
Specialist
Author

Found a solution to this.. its giving the results as expected.

=if(unit_type = 'Operations' and Source = 'Rates',

sum({<Source={'Cash'}>} total <unit_type> Amnt)/
sum({<Source={'Hours'}>} total <unit_type> Amnt), Sum(Amnt))