cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
beekee
Helper IV
Helper IV

Display data when Select All is/is not selected

Hi

 

I have a slicer below and want to achieve the following scenarios. Currently I have this measure, not sure how I can improve it 

IF(SELECTEDVALUE(Selection_LineChartOption[Option])="Eraser",1 , IF(DISTINCTCOUNT(Selection_LineChartOption[Option])>=0 , 1,0))

 

beekee_0-1626191788832.png

Scenarios

beekee_1-1626192003795.png

 

Regards,

BK

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @beekee 

try this measure

 

Measure = 
var _selvalue=SELECTEDVALUE('Table'[Option])
var _countAll=CALCULATE(COUNTROWS('Table'),ALL('Table'))
var _countSel=CALCULATE(COUNTROWS('Table'),ALLSELECTED('Table'))
return
SWITCH(TRUE(),
_countSel=0,1,
_countSel=_countAll,1,
_countSel=1&&_selvalue="Eraser",1,
COUNTROWS('Table')=2&&COUNTROWS(INTERSECT(ALLSELECTED('Table'[Option]), FILTER('Table','Table'[Option] in {"Chair", "Eraser"})))=2,1,
0)

 

result

vxiaotang_0-1626660703290.gif

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-xiaotang
Community Support
Community Support

Hi @beekee 

try this measure

 

Measure = 
var _selvalue=SELECTEDVALUE('Table'[Option])
var _countAll=CALCULATE(COUNTROWS('Table'),ALL('Table'))
var _countSel=CALCULATE(COUNTROWS('Table'),ALLSELECTED('Table'))
return
SWITCH(TRUE(),
_countSel=0,1,
_countSel=_countAll,1,
_countSel=1&&_selvalue="Eraser",1,
COUNTROWS('Table')=2&&COUNTROWS(INTERSECT(ALLSELECTED('Table'[Option]), FILTER('Table','Table'[Option] in {"Chair", "Eraser"})))=2,1,
0)

 

result

vxiaotang_0-1626660703290.gif

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Pragati11
Super User
Super User

Hi @beekee ,

 

I am not sure if I understand the query here.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

 

Thanks,

Pragati

Best Regards,

Pragati Jain

MVP logoDACertAzCert

LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hi @Pragati11 

 

Basically what I'm trying to do is to return 1 whenever Eraser is being selected in the Option slicer. 

When Select All is selected in Option slicer, the measure should return 1.

When Select All is not selected in Option slicer, the measure should return 1. 

When Eraser is selected in Option slicer, the measure should return 1.

When Eraser and Chair is selected Option slicer, the measure should return 1.

 

beekee_0-1626193107963.png

 

 

Regards,

BK

 

Helpful resources

Announcements
May 23 2022 epsiode 5 without aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through June10th!

Power BI Dev Camp Session 22 without aka link and time 768x460.jpg

Check it Out!

Watch Session 22 Ted's Dev Camp along with past sessions!

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!

Top Kudoed Authors