
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
average of aggregate function of a field shows mismatch in table and KPI- Qliksense
RevnPerDay =(Total Revenue of a vehicle/ Total service days of a vehicle)
ServLifeTimeinDays= Total service days of a vehicle
I have 2 measures:
1.Revenue per Model= avg(aggr(nodistinct avg({1} RevnPerDay), Model)) --->To avg revenue per day for that vehicle's Model
2.Average days per Model=avg(aggr(nodistinct avg({1} ServLifeTimeinDays), Model)) -- > to get avg service days for that vehicle's model.
Target revenue for a vehicle= Revenue per model * avg days per model
Expanded---> [
Target revenue for a vehicle= avg(aggr(nodistinct avg({1} RevnPerDay), Model)) * avg(aggr(nodistinct avg({1} ServLifeTimeinDays), Model))
]
Revenue per model | avg days per model | Target Revenue | Model |
(AVG) 63.62427221 | (AVG) 479.7551341 | (AVG) 30704.40307 | |
67.39077237 | 527.6329563 | 35557.59245 | Model 1 |
59.85777205 | 431.8773118 | 25851.21368 | Model 2 |
In KPI it shows value "30,524.07" --->> 30,524.07= 67.39*479.75 (1st and 2nd columns-above table).
I don't want like this in KPI , i want the value 30704.40 to be shown in KPI too.
Please help.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
found the solution. The table takes row by row average. So to do as same in KPI do aggregate of vehicle. it will work same as table.
solution:
avg({1}aggr( avg(aggr(nodistinct avg({1} RevnPerDay), Model))*(avg(aggr(nodistinct avg({1} ServLifeTimeinDays), Model))) ,Vin_No))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
found the solution. The table takes row by row average. So to do as same in KPI do aggregate of vehicle. it will work same as table.
solution:
avg({1}aggr( avg(aggr(nodistinct avg({1} RevnPerDay), Model))*(avg(aggr(nodistinct avg({1} ServLifeTimeinDays), Model))) ,Vin_No))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use this
avg(aggr(avg(aggr(nodistinct avg({1} RevnPerDay), Model)) * avg(aggr(nodistinct avg({1} ServLifeTimeinDays), Model)),Model))
