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'm trying to add a new calculated column for the count of customer accounts per user (Name) in my data set.
How do I do this?
I only need the count for specific years. Like in the example table below, Kalvin would show 2 in the new column for 2020 and 1 for 2021.
| Name | Acc no | Year |
| Josh | 1 | Dec23 |
| Kalvin | 20 | Dec20 |
| Basey | 3 | Dec21 |
| Kalvin | 20 | Dec20 |
| Kalvin | 20 | Dec21 |
Solved! Go to Solution.
Hey @Anonymous ,
You can use DAX statement to create a calculated column:
Column =
var currentName = 'Table'[Name]
var currentYear = 'Table'[Year]
return
COUNTROWS(
FILTER(
'Table'
, 'Table'[Name] = currentName && 'Table'[Year] = currentYear
)
)
The table will look like this (do not wonder about the year column, this happened by pasting your data into a table):
Hopefully, this provides what you are looking for.
Regards,
Tom
Hi @TomMartens
Please find the below measure and screenshot for your reference.
If this post helps, then please consider Accept it as the solution
Thanks,
Hari R
Hi @TomMartens
Please find the below measure and screenshot for your reference.
If this post helps, then please consider Accept it as the solution
Thanks,
Hari R
Hey @Anonymous ,
You can use DAX statement to create a calculated column:
Column =
var currentName = 'Table'[Name]
var currentYear = 'Table'[Year]
return
COUNTROWS(
FILTER(
'Table'
, 'Table'[Name] = currentName && 'Table'[Year] = currentYear
)
)
The table will look like this (do not wonder about the year column, this happened by pasting your data into a table):
Hopefully, this provides what you are looking for.
Regards,
Tom
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 39 | |
| 37 | |
| 29 | |
| 24 |
| User | Count |
|---|---|
| 119 | |
| 100 | |
| 72 | |
| 69 | |
| 65 |