Forum Discussion
Count values for a column while filtering another column
Hi Power BI Comunity, please help
I need to count values for column "Items_Category" in Power BI, if my source only gives me 2 columns- Category & Items?
Items_Category is the output in 3rd column/ measure derived by adding items based on Category, Eg: Electronics = 50+125+200 = 375, but it has to show for all Electronics related rows.
Should i add column or use measure- please suggest what, why and how- it would be great.
| Category | Items | Items_Category |
| Electronics | 50 | 375 |
| Clothing | 75 | 450 |
| Miscellaneous | 100 | 525 |
| Electronics | 125 | 375 |
| Clothing | 150 | 450 |
| Miscellaneous | 175 | 525 |
| Electronics | 200 | 375 |
| Clothing | 225 | 450 |
| Miscellaneous | 250 | 525 |
Hello @Gguliani ,
Try creating a column like the following:
CountCalc ? CALCULATE(SUM(tablename[Items]), FILTER(tablename, tablename[Category] ? EARLIER(tablename[Category] )))
Thank you
Pragati
6 Replies
- Pragati11Super User
Hi Anonymous ,
Your question is not very clear. Can you describe more on what's your current input is and what output is required?
Thanks,
Pragati
- AnonymousNot applicable
Sorry, i realised that too and updated it, please check