Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

How to create custom filter

Hello. I have two tables. First has product id and appropriate value, while the second has countries which have made the trade. So if I select one product the second table shows countries which have also exported the selected product. Now I want a filter that shows values greater than which is input by the user. for example, if the user wants to see total values for each product greater than 10 mln $ so minimum value in the first table must be 10. How can I create that type of filter?

4 Replies

  • negi007's avatar
    negi007
    Community Champion

    Anonymous  Hi in this case you will need to create a calculated table like belwo for two slicer values

     

    Step 1:

    Data_Type_Selected = {
    (1,">10 Mio"),
    (2,"<10 mio")
    }
     
    Create your measure that will filter values basis your selection
    Step 2: 
    Data_type_Filter_value =
    IF(HASONEFILTER(Data_Type_Selected[Selection]),
    SWITCH(SELECTEDVALUE(Data_Type_Selected[Selection]),
    ">10 mio", SUM(product value),
    "<10 mio", SUM(product value),
    ),
    BLANK()
    )
     
    In case you are not able to perform above steps, please share your sample data in text format.
  • Anonymous's avatar
    Anonymous
    Not applicable

    hi Anonymous, You will not be able to create slicers using measures in Power BI. But if you want to build it using a direct numeric column - you can use the approach as seen in the screen grabs

     

     

     

     

     

    Please mark the post as a solution if my comment helped with solving your issue. Thanks! 

     

  • v-lili6-msft's avatar
    v-lili6-msft
    Community Support

    hi  Anonymous 

    For your case, you need to create a parameter for a slicer, you could just use what if parameter to get it.

    https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-what-if

     

    Then use this parameter measure as a conditional as below:

    Measure = SUMX(FILTER(VALUES('Table'[product id]),[Total values]>[Parameter Value]),[Total values])

    If you still have problem, please share your sample pbix file and your expected output. 

     

    Regards,

    Lin