Forum Discussion
only count selected values show selected
Hi There,
I am new to DAX.
I want to write a messure that counts the number of unique products that a user selects in a certain column.
I wrote the following query:
when use this messure in a card visual I get 5. Which is the total number of products. But no selection has been made.
I would have expected blank or 0, since no selection has been made.
I would appriciate some help.
Thank you.
Thank you for you for you help.
I used the following. and now it works:only count number of selected values = CALCULATE(
(ISFILTERED('Sales Sheet'[Product]) * DISTINCTCOUNT('Sales Sheet'[Product])),
ALLSELECTED('Sales Sheet'[Product]))
4 Replies
- FowmySuper User
- elouiziHelper II
Unfortunatelly. That does not give me the right results.
The table is being used as a filter. The filter in the table should be ignored and only the external filter should be activated.
when no selection has been made. I see the folowing in a table:product messure desired result
A 1 0 when nothing has been selected by the user. 1 when a user selects somehting (same for the others)
B 1 0
C 1 0
D 1 0
total 4 0
- CNENFRNLCommunity Champion
number of selected values = ISFILTERED( 'Sales Sheet'[Product] ) * DISTINCTCOUNT( 'Sales Sheet'[Product] )- elouiziHelper II
Thank you for you for you help.
I used the following. and now it works:only count number of selected values = CALCULATE(
(ISFILTERED('Sales Sheet'[Product]) * DISTINCTCOUNT('Sales Sheet'[Product])),
ALLSELECTED('Sales Sheet'[Product]))