Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to do a sum on a Value column per Row ID.
| Row ID | Value |
| 0 | 0.5 |
| 0 | 0.5 |
| 0 | 0.5 |
| 1 | 1.7 |
| 1 | 1.7 |
| 1 | 1.7 |
| 1 | 1.7 |
| 2 | 2.3 |
| 2 | 2.3 |
| 3 | 1.1 |
| 3 | 1.1 |
| 3 | 1.1 |
| 3 | 1.1 |
| 3 | 1.1 |
My calculation should take only one value per Row ID
0.5+1.7+2.3+1.1 = 5.6
If you are doing this in the front end (sheets/charts), you would use Row ID as dimension and sum(Value) as measure.
To do this in the load script you use the group by function to aggregate per Row ID..
Load "Row ID",
Sum(Value) as NewValue
From ...
Group by "Row ID";
This creates a new table with the aggregated values.
@Lisa_P Hi, I want to do this as a Text KPI on the front end. Built it using
SUM(Aggr(Only(Value),Row ID))
@qlikwiz123 IF you are looking for KPI then I believe you have two options
1. Use Sum(Value) formula in KPI and then select any Row Id as per need in filter.
2. Or you can use set analysis and hardcode the Row Id using following Sum ( {<Row ID = {0}>} Value)
Maybe just:
sum(aggr(sum(distinct Value), [Row ID]))
or
sum(aggr(avg(Value), [Row ID]))
if you are trying to sum up the distinct values and show on the KPI, then = Sum(DISTINCT Value) should work. if try to group by Row ID you may get different results but if you wanna consider different values for the same id and do it for all other ids then prolly @marcus_sommer solution should do the job.