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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

"Pivoting" a table using DAX

Pivoting a table to use in a Histogram
2 hours ago

Hello, my data currently looks like this. 

AgeCount
233020
454736
572987

 

Basically, the client counted buyers by buyer age. I want to show this count in a histogram, with age buckets like ">20", "20-29", etc. To do this, I used a DAX calculated column. The client also wants to see percentages, so I created another DAX calculated column that takes each Count value and divides it by the total Count column sum. The table looks like this now. 

Age

Count

Age Bucket

Percentage
233020

20-29

12%
45473640-4915%
57298750-596%

 

However, the client wants a table on the dashboard that looks like this: 

Metric

20-2940-4950-59
Count302047362987
Percentage12%15%6%

 

Is there a good way to do this, I am currently exploring using SUMMARIZECOLUMNS.

 
1 ACCEPTED SOLUTION
whitch
Resolver I
Resolver I

In the formatting options for a matrix, under 'values' theres a 'show on rows' option.  If you turn this on, then put [Age Bucket] in columns and both [Count] and [Percentage] in values, then this should get you the result you want.  You may have to make Count and Percentage measures, but these can just be like:

CountMeasure = SUM('YourTableName'[Count]) 

View solution in original post

1 REPLY 1
whitch
Resolver I
Resolver I

In the formatting options for a matrix, under 'values' theres a 'show on rows' option.  If you turn this on, then put [Age Bucket] in columns and both [Count] and [Percentage] in values, then this should get you the result you want.  You may have to make Count and Percentage measures, but these can just be like:

CountMeasure = SUM('YourTableName'[Count]) 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.