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

Bar Chart: show counts

I have been reading through the documentation for Power Bi and working on a sample report to get up to speed with it. I have made a sample input file storing data about people. Example:

 

Name                 ID                     Age                   

Peter                 1234                    20

Sandra              7777                    56

...

etc

 

I don't know why I'm struggling to figure this out, but I want to create a bar chart that will show the counts for each age in the chart.

So for example if there were five people aged 20 etc. Do I need to create a measure for each age in the table and add each one to the chart? I really can't see where to go with this

1 ACCEPTED SOLUTION
Anonymous
Not applicable

If you put Age on the Axis, and create this measure and put in the Values, you will be set.  It's all about context, and Age provides the context in which that measure will be evaluated.  That's the great thing about DAX, create one measure and it can do a lot!

Count = COUNTROWS ( TABLE )

If you have a lot of data with a lot of different ages, the chart may become a little congested, so might need to consider using ranges ( i.e. ages between 10 and 20 and get the total for those) but not sure that will be needed.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

If you put Age on the Axis, and create this measure and put in the Values, you will be set.  It's all about context, and Age provides the context in which that measure will be evaluated.  That's the great thing about DAX, create one measure and it can do a lot!

Count = COUNTROWS ( TABLE )

If you have a lot of data with a lot of different ages, the chart may become a little congested, so might need to consider using ranges ( i.e. ages between 10 and 20 and get the total for those) but not sure that will be needed.

Anonymous
Not applicable

I should've been able to figure that out! Thanks for your help 🙂

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.