March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi BI Team,
I am trying to calculate the distinct count of customer code column without/exclude the specific the number/name below.
Without/Exclude the value in customer code column have:
- 9999...
- 29100...
- 1075....
Please kindly advise the measure of this calcualtion.
Source Link - https://drive.google.com/drive/folders/1h4G65DGngL5oYU6JadAA8PbdyowuaxSn?usp=sharing
Solved! Go to Solution.
So sorry if I dont understand your requeriment correctly.
The following measure will exclude those codes that START with the values you say:
Dist_Count Coverage =
CALCULATE(
DISTINCTCOUNT(Coverage[CUST_CODE]),
LEFT( Coverage[CUST_CODE], 4 ) <> "9999"
&& LEFT( Coverage[CUST_CODE], 5 ) <> "29100"
&& LEFT( Coverage[CUST_CODE], 4 ) <> "1075"
)
Hope that helps!
Hi there!
Have you tried:
CALCULATE(
DISTINCTCOUNT( YourTable[CustomerCode] ),
NOT( YourTable[CustomerCode] IN { Code1, Code2 } )
)
Let me know if that helps!
Hi @PabloDeheza ,
I am trying your measure but it seem not working. Please help to check the screenshot below.
Can you provide the error message? Thanks
Hi @PabloDeheza,
Please kindly check the screenshot or file - https://drive.google.com/drive/folders/1h4G65DGngL5oYU6JadAA8PbdyowuaxSn?usp=sharing
The problem is you are treating the code column as an integer and it is a string, add double quotes to the numbers and it should work.
CALCULATE(
DISTINCTCOUNT( YourTable[CustomerCode] ),
NOT( YourTable[CustomerCode] IN { "Code1", "Code2" } )
)
Hi @PabloDeheza ,
After trying your measure, it's still include the these customer code below.
- 99999...
- 1075...
- 29100
Please kindly check and advise again.
For Dist_Count answer correctly in excel is:
For your measure in BI is:
So sorry if I dont understand your requeriment correctly.
The following measure will exclude those codes that START with the values you say:
Dist_Count Coverage =
CALCULATE(
DISTINCTCOUNT(Coverage[CUST_CODE]),
LEFT( Coverage[CUST_CODE], 4 ) <> "9999"
&& LEFT( Coverage[CUST_CODE], 5 ) <> "29100"
&& LEFT( Coverage[CUST_CODE], 4 ) <> "1075"
)
Hope that helps!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |