Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowTry your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now
Hi .
I'm doing stack bar visualization with date on xaxis & City as legend with 2 measures A & B. Now how can i write dax expressoin to show stack bar to compare Capital vs operating spend .?
Measure A is % of Capitl Spend ( when Operating type ='C' then actuals column)
Measure B is % of Operating Spend( when operarting type ='O' then Actuals columns)
Thanks
RF
Solved! Go to Solution.
Hi @refint650 ,
I create a simple sample. Please check if this could meet your requirements:
Measure =
VAR TypeAmount =
SUM ( data[Amount] )
VAR AllAmount =
CALCULATE ( SUM ( data[Amount] ), ALL ( data ) )
RETURN
DIVIDE ( TypeAmount, AllAmount )
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Try these measures
Total spend = sum(data[amount])
Capital spend = calculate([total spend],data[operating type]="C")
Operating spend = calculate([total spend],data[operating type]="O")
Capital spend (%) = divide([capital spend],[total spend])
Operating spend (%) = divide([operating spend],[total spend])
If this does not get your desired result, then share the link from where i can download your PBI file and show the exected result very clearly.
Hi Ashish
Appreciate for help. how can we show capital & Operating in same single stacked bar in single dax calculation.?
RF
Hi @refint650 ,
I create a simple sample. Please check if this could meet your requirements:
Measure =
VAR TypeAmount =
SUM ( data[Amount] )
VAR AllAmount =
CALCULATE ( SUM ( data[Amount] ), ALL ( data ) )
RETURN
DIVIDE ( TypeAmount, AllAmount )
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Share some data to work with.
| User | Count |
|---|---|
| 24 | |
| 22 | |
| 22 | |
| 21 | |
| 13 |
| User | Count |
|---|---|
| 67 | |
| 56 | |
| 45 | |
| 42 | |
| 30 |