cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
testaccount222 Frequent Visitor
Frequent Visitor

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

Accepted Solutions
Nick_M New Contributor
New Contributor

Re: Bar Chart: show counts

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.

2 REPLIES 2
Nick_M New Contributor
New Contributor

Re: Bar Chart: show counts

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.

testaccount222 Frequent Visitor
Frequent Visitor

Re: Bar Chart: show counts

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