Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
refint650
Helper III
Helper III

Stack Bar % Measure

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

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

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 )

typeamount.PNG

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish 

 

Appreciate for help. how can we show capital & Operating in same single stacked bar  in single dax calculation.? 

 

 RF

Icey
Community Support
Community Support

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 )

typeamount.PNG

 

 

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.