Forum Discussion
slicer no selection
- 7 years ago
Hi Anonymous,
I have modified my formula with countProd, you could refer to it:
countProd = IF(ISFILTERED(Sheet7[Product]),DISTINCTCOUNT(Sheet7[Product]),IF(ISBLANK(SELECTEDVALUE(Sheet7[Product])),0))
Result:
Hope it could help you.
Regards,
Daniel He
Hi Anonymous,
Could you please offer me some sample data to have a test and post your desired result?
Regards,
Daniel He
- Anonymous7 years agoNot applicable
Thanks for offering your help,
Attached is my table and my display (with my slicer and my attempts to count)
Indeed I did two attempts of measures
countProd = DISTINCTCOUNT(Sheet7[Product]) countProd with is filtered = if(ISFILTERED(Sheet7[CTRY]);DISTINCTCOUNT(Sheet7[Product]);0)
for countProd, my problem is that the results when select all is checked and when there is nothing checked is the same (4) whereas it should be blank and after I can put a if condition for this blank
for countProd with is filtered, it solved the problem when nothing is selected but now when > 1 thing is selected is filtered = false and then it put 0 while it should be 4.
Thanks a lot!
- v-danhe-msft7 years agoMicrosoft Employee
Hi Anonymous,
I have modified your formula, you could refer to it:
countProd = IF(ISBLANK(SELECTEDVALUE(Sheet7[Product])),0,DISTINCTCOUNT(Sheet7[Product]))
countProd with is filtered = if(ISFILTERED(Sheet7[CTRY]),0,DISTINCTCOUNT(Sheet7[Product]))
Result:
You could also download the pbix file to have a view.
Regards,
Daniel He
- Anonymous7 years agoNot applicable
Hi v-danhe-msft
Thanks, unfortunately I could not open your pbix cause my power bi desktop session could not open it (maybe too old?).
Based on your two new formulas for the measures:
- countProd still does not work but now it works when nothing selected but still when selected >1, it shows 0, so i dont see how come it enters into the isblank() except if selectedvalue is only 1 and exactly 1 value...
- countProd with is filtered works now IF i remove the select all option.
Any clues about the first countProd? can it come from my power bi desktop version?
Thanks again for your help