Forum Discussion
DAX DISTINCTCOUNT FUNCTION
Good evening, I'm starting to use Power BI and would like your help in the following please:
I want to know the number of different codes but per request.
I used a formula but it results in the numbers of different codes in general:
| N°PEDIDO | CODE |
| 5422372 | 092091 |
| 5422372 | 092092 |
| 5422373 | 092091 |
| 5422373 | 092237 |
| 5422373 | 092238 |
I look forward to your help, thank you very much.
2 Replies
- slakshmip07Frequent Visitor
Hi,
If you want 5 in your card visual, you will have to use the below DAX:
Measure= COUNT(BD_OUT[CODE])Using DISTINCTCOUNT will give you 4 as it counts the distinct values only, i.e, 92091,92092,92237, and 92238.
If you want to see it as a 2 and 3 split, you will have to use a table visual and use the same measure.Below is what you will get,
Hope this helps,
Lakshmi- Syndicate_AdminAdministrator
Hello Lakshmi, good afternoon
I have a problem using that formula, for example, in this order using the measure "Count" results in 8 items, but it is actually 7 since 1 is repeated. in this case how would you fix the formula?
Thanks for the help
Best regards