Forum Discussion
Count distinct values Issue with non unique
- 5 years ago
try the following formula:
countdistinctnonblank = CALCULATE(DISTINCTCOUNTNOBLANK(emails[link]), emails[link]<>"" && NOT ISBLANK(emails[link]))
themistoklis amitchandak Anonymous
Thanks a lot for such a quick response.
I tried all of your solutions and only themistoklis solution gave me the correct results:
themistoklis Do you know why I need to wrap around CALCULATE? Why just simple function DISTINCTCOUNTNOBLANK does not have correct results?
- themistoklis5 years agoCommunity Champion
Hello ignas
I used 'Calculate' function as I had to apply filters (e.g. <>"" && NOT IS BLANK) in the formula.
You can only apply filters in a formula through the CALCULATE function.
https://docs.microsoft.com/en-us/dax/calculate-function-dax
- ignas5 years agoAdvocate II
themistoklis
I understand how CALCULATE function works. I just cannot understand why I cannot use only DISTINCTCOUNTNOBLANK function in this case? Why if I only use DISTINCTCOUNTNOBLANK it still gives me a value of 4 which means it still counts blanks.- themistoklis5 years agoCommunity Champion
It has to do with your background data. PowerBI treats differently Blank, NULL and EMPTY values.
Maybe the following 2 articles will give you the answer:
https://www.sqlbi.com/articles/blank-handling-in-dax/