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,
I have a table names "Payment" as follows with four filed.
I need to generate the fourth coulumn CountItem.
In excel it was farely simple using the countif(), how do we do it here using dax?
Item Date Amount CountItem
A 01-Jan-2018 10 3
A 02-Jan-2018 10 3
A 03-Jan-2018 10 3
B 01-Jan-2018 10 2
B 02-Jan-2018 10 2
C 01-Jan-2018 10 2
C 02-Jan-2018 10 2
Thanks,
Sami
Solved! Go to Solution.
HI Sami @samihuq
CountItem =
VAR myitem = TableName[Item]
RETURN
COUNTROWS ( FILTER ( TableName, TableName[Item] = myitem ) )
@samihuq,
You can also use the following DAX.
CountItem = CALCULATE(COUNT(Table[Item]),ALLEXCEPT(Table,Table[Item]))
Regards,
Lydia
@samihuq,
You can also use the following DAX.
CountItem = CALCULATE(COUNT(Table[Item]),ALLEXCEPT(Table,Table[Item]))
Regards,
Lydia
Thanks @Anonymous your solution also worked like a charm 🙂
HI Sami @samihuq
CountItem =
VAR myitem = TableName[Item]
RETURN
COUNTROWS ( FILTER ( TableName, TableName[Item] = myitem ) )
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 53 | |
| 42 | |
| 41 | |
| 20 | |
| 19 |