Forum Discussion

Aleria88's avatar
Aleria88
New Member
1 year ago

Slicer Manipulation

I have been search for 2 days on how to get this to work and none of the videos I have watched pertain to my need. I don't know if my ask is too complicated but here goes. I have two slicers. One has Production Line options and the other has Shift Options. Some production lines have two shifts and the others have one shift. I want the Shift Slicer to only show 1st Shift when certain Production Lines are selected and 1st Shift and 2nd Shift for when the others are selected. 

 

These Slicers come from two tables that don't have a relationship. So, this is the formula I used in the measure...

ShowShift =
VAR SelectedLine =
    SELECTEDVALUE ( ProductionLines[ProductionLine] )
RETURN
    IF (
        SelectedLine = "Fleetline"
            && TREATAS ( { "1st Shift", "2nd Shift" }, Shifts[Shift] ),
        1,
        IF (
            SelectedLine = "Truckline"
                && TREATAS ( { "1st Shift", "2nd Shift" }, Shifts[Shift] ),
            1,
            IF (
                SelectedLine = "HCL"
                    && TREATAS ( { "1st Shift" }, Shifts[Shift] ),
                1,
                IF (
                    SelectedLine = "Minute Miser"
                        && TREATAS ( { "1st Shift" }, Shifts[Shift] ),
                    1,
                    IF (
                        SelectedLine = "Stock Chaser"
                            && TREATAS ( { "1st Shift" }, Shifts[Shift] ),
                        1,
                        IF (
                            SelectedLine = "Titan"
                                && TREATAS ( { "1st Shift" }, Shifts[Shift] ),
                            1,
                            0
                        )))))))
 
If someone can help me I would greatly appreciate it. If not, they'll have to deal with an extra option. At this point, I don't care anymore.

3 Replies

  • Hi! Aleria88 

     

    Can you share the sample data from the tables, and share the expected outcome. Please make sure to hide your PII data before sharing. A sample of 10-20 rows should suffice.

     

     

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi All,
    Firstly AnkitKukreja thank you for your solution!
    And Aleria88 ,What I'm thinking is that if you want to dynamically affect the shift filter by using the proudction line filter, I think it's possible to do so.I think this is possible, I have tried to create some sample data myself, hopefully this will help you understand my thinking, and hopefully my approach will solve your problem.

    ShowShift = 
    VAR SelectedLine = SELECTEDVALUE(_Production_Lines[ProductionLine])
    RETURN 
        IF (
            SelectedLine IN {"Fleetline", "Truckline"},
            IF (VALUES('Shifts'[Shift]) IN {"1st Shift", "2nd Shift"}, 1, 0),
            IF (VALUES('Shifts'[Shift]) = "1st Shift", 1, 0)
        )

    After writing the MEASUREMENT, we put the MEASUREMENT into the FILTER in the shift silicer to exclude the value of 0, and we are ready to fulfill your needs.

    I hope my thoughts help you solve your problem, if you have further questions, feel free to contact me and I will get back to you as soon as I receive the message!

    Hope it helps!

     

    Best regards,
    Community Support Team_ Tom Shen

     

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

     

     

    • Aleria88's avatar
      Aleria88
      New Member

      I'll give it a try and let you know. Hopefully, it will work.