Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Selected slicer

Hi, i have a selected slicer in Tableau same i want to implement it in Power BI 
I have 5 column called level 1 to level 5  i want to show them in a slicer so i have created disconnected table 
and i am using calculated column called( Responce ) which contains Numbers and names and alphabets in the value section in Matrix table 
when i select Level 1 i want to see only the selected level of responce data 
How can i achive it in Power BI

 

  • Hi Anonymous 

    To handle the scenario based on the slicer selection from a disconnected table (ANZSIC_Level_Selector), the following measure can be used to conditionally show rows depending on which level is selected:

     

    Show Row? = 
    VAR SelectedLevel = SELECTEDVALUE('ANZSIC_Level_Selector'[SelectedLevel])
    RETURN 
    SWITCH(
        TRUE(),
        SelectedLevel = "ANZSIC Level 1", NOT(ISBLANK('Data Table'[ANZSIC Level 1])),
        SelectedLevel = "ANZSIC Level 2", NOT(ISBLANK('Data Table'[ANZSIC Level 2])),
        SelectedLevel = "ANZSIC Level 3", NOT(ISBLANK('Data Table'[ANZSIC Level 3])),
        TRUE(), 1
    )

    This measure shows 1 only for rows where the selected slicer level's column isn't blank, with a fallback to handle no selection. Add it to your table visual and filter for Show Row? = 1 to display only relevant rows.

     

    If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it

    Best Regards,
    Sreeteja.
    Community Support Team 

9 Replies

  • Hello Anonymous 

    try this

    Create a Disconnected Table

    Go to "Enter Data" and create a table like this:

    LevelName

    ANZSIC Level 1

    ANZSIC Level 2

    ANZSIC Level 3

    ANZSIC Level 4

    ANZSIC Level 5

    Name it ANZSIC_Level_Table.

    Add a Slicer

    Use the LevelName column from ANZSIC_Level_Table in a slicer visual.

     

    Create a Measure to Dynamically Show the Selected Level's Data

    Selected ANZSIC Value =

    VAR SelectedLevel = SELECTEDVALUE('ANZSIC_Level_Table'[LevelName])

    RETURN

    SWITCH(

        SelectedLevel,

        "ANZSIC Level 1", SELECTEDVALUE('YourDataTable'[Level 1]),

        "ANZSIC Level 2", SELECTEDVALUE('YourDataTable'[Level 2]),

        "ANZSIC Level 3", SELECTEDVALUE('YourDataTable'[Level 3]),

        "ANZSIC Level 4", SELECTEDVALUE('YourDataTable'[Level 4]),

        "ANZSIC Level 5", SELECTEDVALUE('YourDataTable'[Level 5]),

        BLANK()

    )

     Replace 'YourDataTable' with the actual name of your main table.

     

    Use the Measure in Matrix

    Place the dimension you want on Rows (e.g., IDs, categories).

    Use Selected ANZSIC Value measure in the Values section.

    Thanks

     Pankaj Namekar | LinkedIn

    If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Pankaj Thanks for your responce 
      i created with this measure previously 

      VAR SelectedLevel = SELECTEDVALUE('ANZSIC_Level_Table'[LevelName])

      RETURN

      SWITCH(

          SelectedLevel,

          "ANZSIC Level 1", SELECTEDVALUE('YourDataTable'[Level 1]),

          "ANZSIC Level 2", SELECTEDVALUE('YourDataTable'[Level 2]),

          "ANZSIC Level 3", SELECTEDVALUE('YourDataTable'[Level 3]),

          "ANZSIC Level 4", SELECTEDVALUE('YourDataTable'[Level 4]),

          "ANZSIC Level 5", SELECTEDVALUE('YourDataTable'[Level 5]),

          BLANK()

      )
      what what are all the data available in the matrix visual is not changing if we select any anzsic levels from the slicer in power BI 
      i have added the data column in the dax also it is not changing this is the dax i have used 

      VAR SelectedLevel = SELECTEDVALUE('ANZSIC_Level_Selector'[SelectedLevel])

      VAR IsMatch =

          SWITCH(

              TRUE(),

              SelectedLevel = "ANZSIC Level 1", NOT ISBLANK(SELECTEDVALUE('Data Table'[ANZSIC Level 1])),

              SelectedLevel = "ANZSIC Level 2", NOT ISBLANK(SELECTEDVALUE('Data Table'[ANZSIC Level 2])),

              SelectedLevel = "ANZSIC Level 3", NOT ISBLANK(SELECTEDVALUE('Data Table'[ANZSIC Level 3])),

              SelectedLevel = "ANZSIC Level 4", NOT ISBLANK(SELECTEDVALUE('Data Table'[ANZSIC Level 4])),

              SelectedLevel = "ANZSIC Level 5", NOT ISBLANK(SELECTEDVALUE('Data Table'[ANZSIC Level 5])),

              FALSE

          )

      RETURN

          IF(IsMatch, SELECTEDVALUE('Data Table'[Response]))



      • v-sshirivolu's avatar
        v-sshirivolu
        Community Support

        Hi Anonymous ,
        Try These Steps to resolve.

        Add Disconnected Slicer Table

        SelectedLevel 
        ---------------------
        ANZSIC Level 1 
        ANZSIC Level 2 
        ANZSIC Level 3 

        Name this table: ANZSIC_Level_Selector

        Do not link this table to Data Table (keep it disconnected).

         

        Create Dynamic Measure

        Selected Response =
        VAR SelectedLevel = SELECTEDVALUE('ANZSIC_Level_Selector'[SelectedLevel])
        RETURN
        SWITCH(
        SelectedLevel,
        "ANZSIC Level 1", MAX('Data Table'[ANZSIC Level 1 Response]),
        "ANZSIC Level 2", MAX('Data Table'[ANZSIC Level 2 Response]),
        "ANZSIC Level 3", MAX('Data Table'[ANZSIC Level 3 Response]),
        BLANK()
        )

        Add Visuals

        1. Add a Slicer:
        Drag SelectedLevel from the ANZSIC_Level_Selector table into the slicer.

        2. Add a Matrix visual:
        Rows: Drag ID from the Data Table
        Values: Drag the measure Selected Response

        Find the below attached .pbix file for your reference.

        If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it

        Best Regards,
        Sreeteja.
        Community Support Team 



  • tanisha_bh09's avatar
    tanisha_bh09
    Frequent Visitor

    Hi, This can be achieved using a disconnected table + SWITCH measure.
    Create a slicer table like:
    Level Selector = DATATABLE( "Level", STRING, { {"Level 1"}, {"Level 2"}, {"Level 3"}, {"Level 4"}, {"Level 5"} } )
    Then create a measure:
    Selected Response = SWITCH( SELECTEDVALUE('Level Selector'[Level]), "Level 1", MAX(Data[Level 1]), "Level 2", MAX(Data[Level 2]), "Level 3", MAX(Data[Level 3]), "Level 4", MAX(Data[Level 4]), "Level 5", MAX(Data[Level 5]), MAX(Data[Level 1]) )

    Use the Level Selector in the slicer and place Selected Response in the Matrix visual. When the user selects a level, the matrix will display values from the corresponding column. If your Response column contains text values (names, numbers, alphabets), and you need the actual row-level values rather than aggregated values, please share a sample data structure, as the solution may require a Field Parameter or a different DAX approach.