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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Raj341
Frequent Visitor

How to achieve Percent of column total through DAX in bar chart

Hello everyone,

We've successfully obtained the "Percent of Column Total" results in the Matrix visualization. Now, I'm looking to replicate the same outcome in a bar chart. Despite attempting various DAX queries, I haven't been able to achieve the desired results.
Note: I am using Clustered bar chart


Raj341_1-1713894531411.png

Apps,Spent time_bucket_hr , viewers
a         0-2                              60
b         2-4                             70    
a         2-4                             130
b        0-2                               40

Raj341_0-1713894440165.png

Example:

Raj341_2-1713894788056.png

 


Thanks in advance.
Please help me to fix the issue

1 ACCEPTED SOLUTION
v-jingzhan-msft
Community Support
Community Support

Hi @Raj341 

 

You can try this measure. 

Measure = DIVIDE(SUM('Table'[viewers]),CALCULATE(SUM('Table'[viewers]),ALLSELECTED('Table'[Apps])))

vjingzhanmsft_0-1713936534783.png

Your current measure uses ALL('Sheet1'), this will remove all filters on table 'Sheet1', which finally gives you the percent of grand total. To have the percent of column total, you need to remove filters on the column field. 

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

5 REPLIES 5
perezco
Advocate III
Advocate III

just mantain the classic visualization ..and you will get it.
the fancy new one is not allowing it .

v-jingzhan-msft
Community Support
Community Support

Hi @Raj341 

 

You can try this measure. 

Measure = DIVIDE(SUM('Table'[viewers]),CALCULATE(SUM('Table'[viewers]),ALLSELECTED('Table'[Apps])))

vjingzhanmsft_0-1713936534783.png

Your current measure uses ALL('Sheet1'), this will remove all filters on table 'Sheet1', which finally gives you the percent of grand total. To have the percent of column total, you need to remove filters on the column field. 

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Thankyou for sharing the logic.
I am using wrong Dimesion, based on your screenshot. I realized my mistake.
-Thanks a lot for sharing the logic

amitchandak
Super User
Super User

@Raj341 , The measure formula is correct. You can use allselected in place of all, so the other filter can pass.

 

You can enable the label to show it on visually.

 

You can use this new measure as label details to show both labels

 

New Power BI Data Label Customizations (December 2023) - Enhance Your Data Analysis & Reporting:
https://www.youtube.com/watch?v=qe3eW4OkAN8&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thankyou for sharing the useful link to dive into more granularity 🙂

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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