This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hey, im having problem with a calculated column. I have a column with ID CLIENTE (more than 50K lines) including repeated values and I need to do a new column that works with a kind of COUNTIF (returning how many times this ID appear in the column ID CLIENTE) and divide it by 1 (the max value that I can have is 1) so I did this column called "flag client" with this DAX syntax
Solved! Go to Solution.
Try
flag cliente =
DIVIDE (
1,
CALCULATE (
COUNTROWS ( BASE_BANCO2_20221223 ),
ALLEXCEPT ( BASE_BANCO2_20221223, BASE_BANCO2_20221223[ID CLIENTE] )
),
0
)
Try
flag cliente =
DIVIDE (
1,
CALCULATE (
COUNTROWS ( BASE_BANCO2_20221223 ),
ALLEXCEPT ( BASE_BANCO2_20221223, BASE_BANCO2_20221223[ID CLIENTE] )
),
0
)
It worked!! but why can you explain what's the point of using countrows and using allexcept?
COUNTROWS is just a bit more optimised I think, so I tend to use that rather than COUNT.
The real key is the ALLEXCEPT. When you are creating a calculated column every column in the table is part of the filter, ALLEXCEPT removes the extra columns and you can just keep the columns that you need to be in the filter. This also helps to avoid circular dependency errors if you add multiple calculated columns to the same table.
Thanks for the solution and explanation!!
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 32 | |
| 26 | |
| 25 | |
| 24 | |
| 15 |
| User | Count |
|---|---|
| 62 | |
| 48 | |
| 27 | |
| 21 | |
| 20 |