Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jbhca12
Helper I
Helper I

Exclude Records Using Yes/No Slicer

Howdy,

I have a single table with several columns, one of which is called oeeTime.

My report is a machine downtime report, which means I only want to see records/rows of when the machine is not running.

The oeeTime values are 1, 2 or 3. 2 is "up time", so I don't want to see 2. 1 and 3 indicated downtime. 1 means it was un-scheduled downtime and 3 means it was scheduled downtime. So here is what I need...

I'd like to have a "Yes/No" slicer that simply asks the user, "Do you want to include scheduled downtime?" Yes or No.

If the user selects "Yes", then include records with oeeTime = 3 (so oeeTime =1 AND oeeTime = 3), if "No", only display records with oeeTime = 1.

For those records that contain an oeeTime = 1 or oeeTime = 3, I do have a calculated "Planned Downtime" column that is "Yes" or "No" and I'm presently using that column for the Planned Downtime slicer.

jbhca12_0-1625234180006.png

This works OK as based on the above, it filters out any records with oeeTime = 3 (oeeTime = 1 only) and if you either "Select all" or ensure that both "No" and "Yes" are selected (or nothing is selected) then it will include both oeeTime = 1 and oeeTime = 3.

I'd prefer it look like this....

jbhca12_1-1625234389631.png

 

...as to me that is more intuitive for the user, but this behaves such that "No" excludes oeeTime = 3 but if you select "Yes", it only gives you records with oeeTime = 3 and excludes oeeTime = 1, not what I want.


Not sure how best to do this?

Thanks!

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @jbhca12

 

Try measure as:

Measure = 
var _slicer= SELECTEDVALUE(Slicer[Include scheduled downtime?])
return
IF(
    _slicer="Yes",
    IF(
        MAX('Table'[OneTime])=3 || MAX('Table'[OneTime])=1,
        1,
        0),
    IF(
        MAX('Table'[OneTime])=1,
        1,
        0
    )
)

vxulinmstf_0-1625648215719.png

The pbix is attached.

 

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

 

View solution in original post

5 REPLIES 5
v-xulin-mstf
Community Support
Community Support

Hi @jbhca12

 

Try measure as:

Measure = 
var _slicer= SELECTEDVALUE(Slicer[Include scheduled downtime?])
return
IF(
    _slicer="Yes",
    IF(
        MAX('Table'[OneTime])=3 || MAX('Table'[OneTime])=1,
        1,
        0),
    IF(
        MAX('Table'[OneTime])=1,
        1,
        0
    )
)

vxulinmstf_0-1625648215719.png

The pbix is attached.

 

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

 

amitchandak
Super User
Super User

@jbhca12 , you need to create a new column and use that

 

if([oeeTime] =2, "No", "Yes")

I don't think you understood my explaination. oeeTime = 2 is already filtered out...I need to be able to "Yes" or "No" concerning downtime of oeeTime = 1 or oeeTime = 3. I simply want a "Yes" or "No" so the records are oeeTime = 1 only or (oeeTime = 1 AND oeeTime = 3).

Thanks!

@jbhca12 , Those screenshots did not appear when I saw last time. Loading issue.

 

Let me make one more attempt

 

Measure =

var _sel = selectedvalue(slicer[slicer]) //Yes and no slicer

return

if(_sel ="Yes", calculate(sum(Table[value]), filter(Table, Table[oeeTime] in {1,3})) , calculate(sum(Table[value]), filter(Table, Table[oeeTime] in {1})))

 

 

for add 2

 

 

Measure =

var _sel = selectedvalue(slicer[slicer]) //Yes and no slicer

return

if(_sel ="Yes", calculate(sum(Table[value]), filter(Table, Table[oeeTime] in {1,2,3})) , calculate(sum(Table[value]), filter(Table, Table[oeeTime] in {1,2})))

Not sure I understand. Where am I creating this measure? Also, you wrote:

"var _sel = selectedvalue(slicer[slicer])" - How do you reference a slicer?

...and what are you summing as a Table[value]?

Sorry, I think you'll need to dumb this down a bit...I'm not understanding what you are suggesting.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors