cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Toshie
Helper I
Helper I

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

@Toshie,

 

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
Toshie
Helper I
Helper I

Hello @DataInsights ,

Thanks very much the Dax worked perferctly.

DataInsights
Super User
Super User

@Toshie,

 

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
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors