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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

If and or statements (simple)

Hi! I am struggling with a simple issue that I am unable to solve in Power Query. The problem is that when I am adding a custom column with the following logic:

 

if [#"Wage: Range - Ceiling"] > 50 or [#"Wage: Fixed"] > 50 or [#"Wage: Up Until"] > 50 or [#"Wage: Starting From"] > 50 then "Monthly" 

else if [#"Wage: Range - Ceiling"] > 10000 or [#"Wage: Fixed"] > 10000 or [#"Wage: Up Until"] > 10000 or [#"Wage: Starting From"] > 10000 then "Annual"

else "Hourly"

 

 the column returns just "Hourly" and "Monthly" and disregards the "Annual" statement completely. I am assuming there is something wrong with the or statement as all the data types are correct (numbers) and when I put only one column (without or) everything works. I have also tried to put the logic the other way around (if less than 50 then Hourly else Monthly), but then it just returns all values as Hourly. 

 

Here is the problem visualized:

 

image.png

 

 

 

Can anyone point out to me where is the issue? 

Thank you in advance!

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @Anonymous 

You need to place the most restrictive conditions first.  Otherwise, if Wage Fixed is greater than both 50 and 10000, the first condition will be met ("Monthly") and the code won't check for the "Annual" condition

if [#"Wage: Range - Ceiling"] > 10000 or [#"Wage: Fixed"] > 10000 or [#"Wage: Up Until"] > 10000 or [#"Wage: Starting From"] > 10000 then "Annual" else if

[#"Wage: Range - Ceiling"] > 50 or [#"Wage: Fixed"] > 50 or [#"Wage: Up Until"] > 50 or [#"Wage: Starting From"] > 50 then "Monthly" 

else "Hourly"

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thank you very much!

AlB
Community Champion
Community Champion

Hi @Anonymous 

You need to place the most restrictive conditions first.  Otherwise, if Wage Fixed is greater than both 50 and 10000, the first condition will be met ("Monthly") and the code won't check for the "Annual" condition

if [#"Wage: Range - Ceiling"] > 10000 or [#"Wage: Fixed"] > 10000 or [#"Wage: Up Until"] > 10000 or [#"Wage: Starting From"] > 10000 then "Annual" else if

[#"Wage: Range - Ceiling"] > 50 or [#"Wage: Fixed"] > 50 or [#"Wage: Up Until"] > 50 or [#"Wage: Starting From"] > 50 then "Monthly" 

else "Hourly"

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors