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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to calculate % per category

Hello,

 

I have been struggling to find the solution to show the percentage each category on the clustered column chart, such as this. the automated calculation takes from the total number of customers from all years. If you could tell me a Dax function, that would be very helpful. 

What I would like to do: 

(1) % of "Age" in total number of customers in the same "Date"

(2) % of "Age Group" in total number of customers in the same "Date"

Both need to work on Column chart.

Thanks for reading.

 

 

Toshie_0-1644259816444.png

 

 

AgeAge GroupNumber of customersDate% of age each year
1816 -19 yrs5031/03/202233.33%
1916 -19 yrs4031/03/202226.67%
2020 - 24 yrs6031/03/202240.00%
1916 -19 yrs1631/03/20233.16%
2020 - 24 yrs4531/03/20238.88%
2120 - 24 yrs7331/03/202314.40%
2220 - 24 yrs7131/03/202314.00%
2320 - 24 yrs10731/03/202321.10%
2420 - 24 yrs11031/03/202321.70%
2525 - 29 yrs8531/03/202316.77%
2020 - 24 yrs1631/03/20243.79%
2120 - 24 yrs4531/03/202410.66%
2220 - 24 yrs7331/03/202417.30%
2320 - 24 yrs7131/03/202416.82%
2420 - 24 yrs10731/03/202425.36%
2525 - 29 yrs11031/03/202426.07%
2120 - 24 yrs1631/03/20255.13%
2220 - 24 yrs4531/03/202514.42%
2320 - 24 yrs7331/03/202523.40%
2420 - 24 yrs7131/03/202522.76%
2525 - 29 yrs10731/03/202534.29%
2220 - 24 yrs1631/03/20267.80%
2320 - 24 yrs4531/03/202621.95%
2420 - 24 yrs7331/03/202635.61%
2525 - 29 yrs7131/03/202634.63%
1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Anonymous,

 

Try these measures:

 

Total Customers = SUM ( Table1[Number of customers] )
% in Same Date = 
VAR vNumerator = [Total Customers]
VAR vDenominator =
    CALCULATE ( [Total Customers], ALLEXCEPT ( Table1, Table1[Date] ) )
VAR vResult =
    DIVIDE ( vNumerator, vDenominator )
RETURN
    vResult

 

DataInsights_0-1644414086094.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hello @DataInsights ,

Thanks very much the Dax worked perferctly.

DataInsights
Super User
Super User

@Anonymous,

 

Try these measures:

 

Total Customers = SUM ( Table1[Number of customers] )
% in Same Date = 
VAR vNumerator = [Total Customers]
VAR vDenominator =
    CALCULATE ( [Total Customers], ALLEXCEPT ( Table1, Table1[Date] ) )
VAR vResult =
    DIVIDE ( vNumerator, vDenominator )
RETURN
    vResult

 

DataInsights_0-1644414086094.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.