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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

if else in Power Bi calculated column

Hi everyone, 

Im trying to create a range where value is "Less than 50", "More than 50" and "More than 150". I was able to achieve this but I want values that are more than 50 to display inclusive of values more than 150 as well. User should have an option to only to view all data that are more than 50 and if they want to view values more than 150 they should be able to select that.

Range = SWITCH(
TRUE(), 
'All'[Value (USD)] < 50, "Less than 50",
'All'[Value (USD)] > 50 && 'All'[Value (USD)] < 150 , "More than 50",
'All'[Value (USD)] > 150, "More than 150")

This code will segregate data with value 50 and 150. I would like to know if its possible to display data that are more than 50 & 150 when user select "More than 50". If user selects more than 150 then it will only display data with value more than 150.
I hope someone could give a suggestion for this 🙂

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 

you can create or import a separate disconnected table that contains the three text descriptions of the three rangges let's call it 'Ranges' that contains one column [Range]. Inserr a sclicer based on 'Ranges[Range]. Place the following measure in the filter pane of the visual, select "is not blank" and apply the filter

Range =
SWITCH (
    SELECTEDVALUE ( Ranges[Range] ),
    "Less than 50", COUNTROWS ( FILTER ( 'All', 'All'[Value (USD)] < 50 ) ),
    "More than 50", COUNTROWS ( FILTER ( 'All', 'All'[Value (USD)] > 50 ) ),
    "More than 150", COUNTROWS ( FILTER ( 'All', 'All'[Value (USD)] > 150 ) )
)

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi its alright I made it work, thank you for your input 🙂

Anonymous
Not applicable

Its an empty table when i create a table using this measure. When I use it as a slicer for my existing dashboard it only shows More than 150. 

tamerj1
Super User
Super User

Hi @Anonymous 

you can create or import a separate disconnected table that contains the three text descriptions of the three rangges let's call it 'Ranges' that contains one column [Range]. Inserr a sclicer based on 'Ranges[Range]. Place the following measure in the filter pane of the visual, select "is not blank" and apply the filter

Range =
SWITCH (
    SELECTEDVALUE ( Ranges[Range] ),
    "Less than 50", COUNTROWS ( FILTER ( 'All', 'All'[Value (USD)] < 50 ) ),
    "More than 50", COUNTROWS ( FILTER ( 'All', 'All'[Value (USD)] > 50 ) ),
    "More than 150", COUNTROWS ( FILTER ( 'All', 'All'[Value (USD)] > 150 ) )
)

 

Anonymous
Not applicable

Hi @tamerj1 ,
Ive tried the suggested method but it only displays "More than 150" even when all 3 ranges are in table.

@Anonymous 
Would you please share a screenshot of what you've achieved so far?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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