Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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 |
Solved! Go to Solution.
Hello @Gguliani ,
Try creating a column like the following:
CountCalc ? CALCULATE(SUM(tablename[Items]), FILTER(tablename, tablename[Category] ? EARLIER(tablename[Category] )))
Thank you
Pragati
Hello @Gguliani ,
Try creating a column like the following:
CountCalc ? CALCULATE(SUM(tablename[Items]), FILTER(tablename, tablename[Category] ? EARLIER(tablename[Category] )))
Thank you
Pragati
Getting an error @Pragati11 , field names and table names are different than dummy values asked in the query
Hi @Anonymous ,
You forgot to close a bracket after SUM function in your DAX. Check my dax expression again.
Thanks,
Pragati
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
Sorry, i realised that too and updated it, please check
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 33 | |
| 29 |
| User | Count |
|---|---|
| 132 | |
| 90 | |
| 78 | |
| 66 | |
| 65 |