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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

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.

Top Solution Authors