[http://uupload.ir/view/v2t_capture.png] We have 2 tables with 2 columns:
- table location ->column ->city ,province
- table sales column ->actual sales
table location : table sales
province city id sales
tehran eslamshar 1 100
tehran rey 2 500
hamedan tefresh 3 500
esfahan esahan 4 400
gilan rasht 5 400
gilan rar 6 900
I want to calculate 80% of total sales in each city and each province it means if we have 2800 total sale in whole province, we want just show province that cut off 80 % of sales:
I use this measure but it has one problem that duplicate value does not count in a cumulative sum.
If I have two same sale like 900 it does not count in cumulative and it ignores it.
Cumulative Total =
IF (
NOT ( ISBLANK ( [sales] ) ),
CALCULATE (
[sales],
FILTER (
ALL ( DimLocation[Province] ),
CALCULATE ( [sales], VALUES ( DimLocation[Province] ) ) <= [sales]
)
)
)
Expected Result:
sales cumulative
tehran 800 800
shiraz 200 1000
ghom 200 400
markazi 300 500
Output:
tehran 800 800
shiraz 200 1000
ghom 200 1000
markazi 300 500