Forum Discussion
Count per group
Hello,
I think the solution for my question is simple but for some reason I cannot find the answer to my question.
So, I have this table:
| Unit |
| B100 |
| B200 |
| B100 |
| C100 |
| C100 |
| C100 |
| C100 |
| B100 |
| B100 |
| B100 |
| B100 |
| B100 |
| A400 |
| A500 |
| A500 |
| A400 |
| A400 |
| A400 |
| B200 |
| B200 |
And I would like to count the units and sum it per unit. Result will look like this:
| Unit | SUM_OF_Unit |
| A400 | 4 |
| A500 | 2 |
| B100 | 7 |
| B200 | 3 |
| C100 | 4 |
Can someone help me out?
Thanks in advance.
3 Replies
- mh2587Super User
count = count(table[unit])
- WLFRDHelper III
When I use this expression, it counts the total amount of units. I would like to have a total count per unit. In Power BI you can click on 'count' at values and then the total will be shown. I just need a column for a calculation and then I need a column with the totals per unit.
Does this count have to be filtered?
- v-xiaotangCommunity Support
Hi WLFRD
You can try this,
measure code:
SUM_OF_Unit_measure = CALCULATE ( COUNTROWS ( 'Table' ), ALLEXCEPT ( 'Table', 'Table'[Unit] ) )calculated column code:
SumOfCount_column = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Unit]))Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.