Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
KatPrf
New Member

Creating a greater than, equal to or less than text slicer

Hi all! 
have a table in Power BI (called RatingOrder) which has the following columns:  category, rating and order for each rating. Here is some sample data in the table:

category | Rating | Order

Blue | A++ | 3

Blue | A- | 2

Blue | B | 1

Red | A | 4

Red | B+ | 3

Red | B- | 2

Red | C | 1

 

I want the users to be able to select a category (from a slicer) then choose ‘greater than’ or ‘equal to’ or ‘less than’ (which are determined by the order field) using another slicer, and then select a rating and get the results based on their selections. For example if they select category = blue and greater than B, the results they should get are A++ and A-. Or if the select category = Red and less than B+ the output should be B- and C.

Could you please let me know how to achieve the above? I know how to create simple slicers like the category slicer that I mentioned above but not sure how to create the greater than, less than and equal to. 

1 ACCEPTED SOLUTION
Corey_M
Resolver II
Resolver II

for creating the logical operator functionality I would recommend creating a table with those 3 values as rows, and then you can create measures  that operate on the logical slicer.

here is an example measure:

Result Measure = 
VAR SelectedCategory = SELECTEDVALUE('RatingOrder'[category])
VAR SelectedOperation = SELECTEDVALUE('ComparisonOperationTable'[Operation])
VAR SelectedRatingOrder = SELECTEDVALUE('RatingOrder'[Order])

RETURN
    CALCULATE(
        COUNTROWS('RatingOrder'),
        'RatingOrder'[category] = SelectedCategory,
        SWITCH(
            SelectedOperation,
            "greater than", 'RatingOrder'[Order] > SelectedRatingOrder,
            "less than", 'RatingOrder'[Order] < SelectedRatingOrder,
            'RatingOrder'[Order] = SelectedRatingOrder
        )
    )



View solution in original post

1 REPLY 1
Corey_M
Resolver II
Resolver II

for creating the logical operator functionality I would recommend creating a table with those 3 values as rows, and then you can create measures  that operate on the logical slicer.

here is an example measure:

Result Measure = 
VAR SelectedCategory = SELECTEDVALUE('RatingOrder'[category])
VAR SelectedOperation = SELECTEDVALUE('ComparisonOperationTable'[Operation])
VAR SelectedRatingOrder = SELECTEDVALUE('RatingOrder'[Order])

RETURN
    CALCULATE(
        COUNTROWS('RatingOrder'),
        'RatingOrder'[category] = SelectedCategory,
        SWITCH(
            SelectedOperation,
            "greater than", 'RatingOrder'[Order] > SelectedRatingOrder,
            "less than", 'RatingOrder'[Order] < SelectedRatingOrder,
            'RatingOrder'[Order] = SelectedRatingOrder
        )
    )



Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.