Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

slicer saving last selected value

Hello All,

 

I have a report where I have slicer values like US-Canada,APAC and Overall.

And I have department values like Central,Georgia,Hyd and Pune

 

My requirement is If I select slicer  as US-Canada then I need to show only Central,Georgia

                               If I select slicer as APAC then I need to show only Hyd,Pune

                                If I select slicer as Overall then I need to show All 4.i.e, Central,Georgia,Hyd,Pune

 

So I created below dax and put it in filters for department slicer.

I am getting my resuly, But the issue here is its saving the last selected value and showing in other filter also.

 

 

lag = 
SWITCH (
    SELECTEDVALUE ( 'For Slicer'[Value] ),
    "APAC",
        IF (
            MAX ( 'Table'[Department] ) = "Hyd"
                || MAX ( 'Table'[Department] ) = "Pune",
            1,
            0
        ),
    "US-Canada",
        IF (
            MAX ( 'Table'[Department] ) = "Central"
                || MAX ( 'Table'[Department] ) = "Georgia",
            1,
            0
        ),
    1
)

Lets say If I select region slicer as us-canada and  its showing central and Geogia

So Now If I select department as Geogia and then change the region slicer as APAC Its showing Geogia  again in that.

 

 

 

Solved: Re: How to write if else in power Bi Dax - Microsoft Power BI Community 

is what I did 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    I have created a sample to have a test. I think your code is correct. Your issue should be caused that you have selected "Georgia" before. Power BI won't remove the selection though "Georgia" should be hidden based on filter. Here I suggest you to clear selections in "Department" slicer. And then "Georgia" will disappear.

     

    Best Regards,
    Rico Zhou

     

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

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    I have created a sample to have a test. I think your code is correct. Your issue should be caused that you have selected "Georgia" before. Power BI won't remove the selection though "Georgia" should be hidden based on filter. Here I suggest you to clear selections in "Department" slicer. And then "Georgia" will disappear.

     

    Best Regards,
    Rico Zhou

     

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