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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply

100% stacked chart and line chart

Hello,

 

Can I able to create a 100% stacked bar graph that includes a line as well

The table below 

VictoriaNguyen_0-1634080769365.png

Many thanks 

 

1 ACCEPTED SOLUTION

You'll need a measure like this one.  In my case, Year is the x axis and the legend is Product Categories.  This measure is in the values (and a different measure is in the line).

 

Pct of Year Total =
VAR thiscategory = [Total Sales]
VAR allcategory =
    CALCULATE ( [Total Sales], REMOVEFILTERS ( 'Product'[Category] ) )
RETURN
    DIVIDE ( thiscategoryallcategory )

 

mahoneypat_0-1634124726367.png

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Employee
Employee

Yes.  You can use a line and stacked chart with a measure that shows the % of total for that category instead of the actual values (so they all add to 1).  You can add the actual values in the tooltip if needed.

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


@mahoneypat Thank you for your reply. 
How can I write the measure to show the percentages oftotal? I am new to Power BI 

You'll need a measure like this one.  In my case, Year is the x axis and the legend is Product Categories.  This measure is in the values (and a different measure is in the line).

 

Pct of Year Total =
VAR thiscategory = [Total Sales]
VAR allcategory =
    CALCULATE ( [Total Sales], REMOVEFILTERS ( 'Product'[Category] ) )
RETURN
    DIVIDE ( thiscategoryallcategory )

 

mahoneypat_0-1634124726367.png

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.