cancel
Showing results for
Did you mean:
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.

 Age Age Group Number of customers Date % of age each year 18 16 -19 yrs 50 31/03/2022 33.33% 19 16 -19 yrs 40 31/03/2022 26.67% 20 20 - 24 yrs 60 31/03/2022 40.00% 19 16 -19 yrs 16 31/03/2023 3.16% 20 20 - 24 yrs 45 31/03/2023 8.88% 21 20 - 24 yrs 73 31/03/2023 14.40% 22 20 - 24 yrs 71 31/03/2023 14.00% 23 20 - 24 yrs 107 31/03/2023 21.10% 24 20 - 24 yrs 110 31/03/2023 21.70% 25 25 - 29 yrs 85 31/03/2023 16.77% 20 20 - 24 yrs 16 31/03/2024 3.79% 21 20 - 24 yrs 45 31/03/2024 10.66% 22 20 - 24 yrs 73 31/03/2024 17.30% 23 20 - 24 yrs 71 31/03/2024 16.82% 24 20 - 24 yrs 107 31/03/2024 25.36% 25 25 - 29 yrs 110 31/03/2024 26.07% 21 20 - 24 yrs 16 31/03/2025 5.13% 22 20 - 24 yrs 45 31/03/2025 14.42% 23 20 - 24 yrs 73 31/03/2025 23.40% 24 20 - 24 yrs 71 31/03/2025 22.76% 25 25 - 29 yrs 107 31/03/2025 34.29% 22 20 - 24 yrs 16 31/03/2026 7.80% 23 20 - 24 yrs 45 31/03/2026 21.95% 24 20 - 24 yrs 73 31/03/2026 35.61% 25 25 - 29 yrs 71 31/03/2026 34.63%
1 ACCEPTED SOLUTION
Super User

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``````

Proud to be a Super User!

2 REPLIES 2
Helper I

Hello @DataInsights ,

Thanks very much the Dax worked perferctly.

Super User

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``````

Proud to be a Super User!

Announcements