Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi all,
I have 3 tables:
Sales table has 3 columns: Date, PartNo, Amount
DateTable
Part table has 2 columns: PartNo, PartName
I have this measure to calculate the semi annual sales:
SemiAnnualSales = CALCULATE(SUM(Sales[Amount]),DATESINPERIOD(DateTable[Date],LASTDATE(DateTable[Date]),-6,MONTH))
And this mesure to calculate share:
Share = DIVIDE([SemiAnnualSales],CALCULATE([SemiAnnualSales],ALL(Parts)))
My goal is to calculate cummulative share based and ranked by [Share]. I have difficulty because [Share] is a measure.
This is the result I want. Please help!!! Any input is greatly appreciated.
PartNo | SemiAnnualSales | Share | CummulativeShare |
08F60-KVG-740A | 192 | 14% | 14% |
08F60-KVG-710B | 180 | 13% | 27% |
08F60-KVG-720B | 151 | 11% | 37% |
08F60-KVG-750A | 131 | 9% | 47% |
08F60-KVG-710A | 125 | 9% | 56% |
08F60-KVG-720A | 96 | 7% | 62% |
08F62-KWW-710A | 95 | 7% | 69% |
08F63-KVG-740A | 94 | 7% | 76% |
08F60-KVG-730B | 91 | 6% | 82% |
08F60-KVG-740B | 84 | 6% | 88% |
08F60-KVG-730A | 62 | 4% | 93% |
08F63-KVG-730B | 61 | 4% | 97% |
08F63-KVG-740B | 40 | 3% | 100% |
08F60-KVG-750B | 0 | 0% | 100% |
Solved! Go to Solution.
Hi @longpham03
Add the rank measure as index:
Measureindex = RANKX(ALLSELECTED('Table'),[MeasureShare],,DESC)
Then calculate the cumulative sum:
Measure =
var t = ADDCOLUMNS(ALLSELECTED('Table'[PartNo]),"A",[MeasureShare],"B",[Measureindex])
var a = [Measureindex]
return
SUMX(FILTER(t,[Measureindex]<=a),[MeasureShare])
Hi @longpham03
Add the rank measure as index:
Measureindex = RANKX(ALLSELECTED('Table'),[MeasureShare],,DESC)
Then calculate the cumulative sum:
Measure =
var t = ADDCOLUMNS(ALLSELECTED('Table'[PartNo]),"A",[MeasureShare],"B",[Measureindex])
var a = [Measureindex]
return
SUMX(FILTER(t,[Measureindex]<=a),[MeasureShare])
@longpham03 , In the quick measure you have an option for running total, Try that.
Thanks for your help. I was able to choose [Share] for "Base Value", but I couldn't choose [Share] for "Field". I need [Share] to be the running field, DESC.