Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Thanks in Advance.
Renji
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))