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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

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
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.