Forum Discussion

Julian_H's avatar
Julian_H
Helper II
2 years ago

Slicers and Filtering

Hi

 

I have had a request from a work collegue to be able to filter by the value selected  in  the slicer and a defualt value.

 

e.g. slicer has  A B C D E in it

The selection is C which will filter the data to show C data

However I need to show C data plus Z data (a default value)

 

Values C and Z live in the same columnin the table

 

The slicer cant show Z as an option 

 

Please cna nay one help ?

 

Thank you

10 Replies

  • bhelou's avatar
    bhelou
    Responsive Resident

    Try this : 
    Filtered_Data =
    VAR SelectedValue =
    SELECTEDVALUE('Your_Table_Name'[Column_Name]
    )
    RETURN
    FILTER( 'Your_Table_Name', 'Your_Table_Name'[Column_Name]
    =
    SelectedValue
    ||
    'Your_Table_Name'[Column_Name] = "Z"
    )


    • Julian_H's avatar
      Julian_H
      Helper II

      Thank you for replying.

       

      Would you set this as a measure then add it in to the "Filters on this visual" section 

       

  • bhelou's avatar
    bhelou
    Responsive Resident

    Hi , you can put it in a card or a table , 

    for filter just drag and drop anything you want to make filter for it and set the conditions . 

    hope this worked with you , if not share some sample of the PBIX file to go through it 

    • Julian_H's avatar
      Julian_H
      Helper II

      Hi 

      I get the following when set up as a measure

       

       

      • kleigh's avatar
        kleigh
        Responsive Resident

        Have you tried putting in brackets like (Accounts[Earnout_BoBNAme] = SelectedValue) ||  (Accounts[Earnout_BoBNAme] = "Z")  ?

        Sometimes when combining expressions with || the parts associate with a priority that does not match what might be expected. 

  • bhelou's avatar
    bhelou
    Responsive Resident

    Hello , if you can share some sample it would be better to know what is the issue 

    • Julian_H's avatar
      Julian_H
      Helper II

      Unfortunatley this quite sensitive data so cant actually supply a proper example , so here a mock up

       

    • Julian_H's avatar
      Julian_H
      Helper II

      Hi That wouldnt work as it needs to be based on the slicer selection plus Z

      No worries, will keep digging 🙂