Forum Discussion
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
- Anonymous7 years ago
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
- AnonymousNot 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.
- AnonymousNot applicable
I should've been able to figure that out! Thanks for your help :)