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
I have a table with 3 columns, Customer Number, Account Number & Flag. I want to create a calculated column(NOT A MEASURE) which counts the number of accounts per customer when the flag is set to yes.
CustomerNumber AccountNumber Flag ExpectedOutput Actual Output
1 A1 Y 1 3
1 A2 N 1 3
2 A3 Y 2 3
2 A4 Y 2 3
I am using the following formula
Total Business Investment Products =
CALCULATE (
DISTINCTCOUNTNOBLANK ( 'Fact'[AccountNumber] ),
FILTER ( 'Fact', 'Fact'[Flag] = "Y" ),
ALLEXCEPT ( 'Fact', 'Fact'[CustomerNumber] )
)
Solved! Go to Solution.
Hello @Anonymous Give this a try
Total Business Investment Products =
CALCULATE (
DISTINCTCOUNT ( 'Fact'[AccountNumber] ),
ALLEXCEPT ( 'Fact', 'Fact'[CustomerNumber] ),
'Fact'[Flag] = "Y"
)
Hi @Anonymous ,
Is this problem solved?
If it is solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
If not, please let me know.
Best Regards
Icey
Hello @Anonymous Give this a try
Total Business Investment Products =
CALCULATE (
DISTINCTCOUNT ( 'Fact'[AccountNumber] ),
ALLEXCEPT ( 'Fact', 'Fact'[CustomerNumber] ),
'Fact'[Flag] = "Y"
)
@jdbuchanan71 This works but when I use it as Filter('Fact','Fact'[Flag])='Y') it doesnt work? Do you know why?
I believe the ALLEXCEPT is removing the fitler added in the FILTER statement.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 43 | |
| 42 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |