Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

How to create a custom SLICER?

Hello

 

I have two sets of criteria, e.g.:

CriteriaSet1:

Col1 = A || Col2 <> B && Col3 = C

CriteriaSet2:

Col1 = D || Col2 <> E && Col3 = F

 

I want to use these criteria to filter a table. I then want to create a slicer which will have two values: CriteriaSet1 and CriteriaSet2.

 

When I select each of these values, I want to apply the respective criteria.

 

How can I do that? Do I need to create Measures, Tables or anything else? Please explain in your answer instead of just saying CriteriaSet1 = .... without explaining what that is.

 

Thanks!

10 Replies

  • Anonymous add a new custom column with the logic you want and use that for the slicer

     

    New Column =
    IF ( <condition1>, "Criteria 1", 
    IF ( <condition2>, "Criteria 2",
    "Unknown"
    ) )

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.

  • Anonymous , In case you need as in filter.

    calculate([measure], filter(Table,(Col1 = D || Col2 <> E && Col3 = F) && (Col1 = A || Col2 <> B && Col3 = C)))
    • Anonymous's avatar
      Anonymous
      Not applicable

      amitchandak 

       

      Thanks, can you elaborate how do I use that? Also what is the [measure] you mention?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    You will need to create a new table with couluns contains measures' name.

    Use this table as slicer with following measure.

    Measure = SWITCH(SELECTEDVALUE('Table (2)'[slicer]),"sum",[sum],"avg",[avg])

    Sample data for your reference.

     

     

    Best Regards,

    Jay

    • Anonymous's avatar
      Anonymous
      Not applicable

      Anonymous  thanks but can you tell me please what is the below and how do I create it? 

      'Table (2)'[slicer]

       

      Thanks! 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous ,

         

        It's a simple table contains measures' name as the slicer.

        Pbix as attached, hopefully works for you.

         

        Best Regards,

        Jay