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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
siac161
New Member

Help with dax

Hi I'm trying to build a clustered chart. 

The Y axis are a column that have Regions.
The X axis is a distinct count of ID's
The legends are the Years

The issue that I have is that I want to show the percentage of unique ID per year and region. Keeping other visualization filters, such as state, product category etc.

Region20232024
12530
23015
33510
44040
Total13095


So for example region 1 should show 19.23% for 2023 and 31.58% for 2024. But If I use the Distinct count option to "show as a percentage of the grand total" it doesn't make sense. I

I created the next formula. 
Percentage per Year =
VAR TotalCountPerYear =
CALCULATE(DISTINCTCOUNT(Table[ID]), ALLEXCEPT(Table, Table[Year]))

VAR ClusterCount =
DISTINCTCOUNT(TableName[ID])

RETURN
DIVIDE(ClusterCount, TotalCountPerYear)

But I can't make the total remain 130 or 95. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @siac161

Maybe you can try the following DAX 

Percentage per Year = 
VAR TotalCountPerYear = CALCULATE(DISTINCTCOUNT(Table[ID]), ALL(Table), VALUES(Table[Year]))
VAR ClusterCount = DISTINCTCOUNT(Table[ID])
RETURN DIVIDE(ClusterCount, TotalCountPerYear)

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data)

 

How to Get Your Question Answered Quickly 

Best Regards

Yongkang Hua

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

2 REPLIES 2
Anonymous
Not applicable

Hi, @siac161

Maybe you can try the following DAX 

Percentage per Year = 
VAR TotalCountPerYear = CALCULATE(DISTINCTCOUNT(Table[ID]), ALL(Table), VALUES(Table[Year]))
VAR ClusterCount = DISTINCTCOUNT(Table[ID])
RETURN DIVIDE(ClusterCount, TotalCountPerYear)

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data)

 

How to Get Your Question Answered Quickly 

Best Regards

Yongkang Hua

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

 

lbendlin
Super User
Super User

Did you mean to select "Percentage of Column Total" ?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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