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
PCStrouble
New Member

If one of 2 values is less than 20

I have a software that outputs a value in one or two columns. 

 

I have tried to write my own calculate column but always get an error or all zeros.

 

At any time if value_1 is 20 or above i need the formula to output a 1. 

If there is no value_1 but the value_2 over 20 id also need a 1. 

 

The null values i think are whats causing my errors. 

 

Heres what im hoping for.

Value_1

Value_2

Result

Null

Null

0

15

33

0

20

null

1

5

25

0

Null

20

1

30

2

1

Null

19

0

33

Null

1

23

10

1

null

null

0

5 REPLIES 5
FreemanZ
Super User
Super User

hi @PCStrouble 

Try to create a calculated column like:
Column =
IF(
   OR(
       [value_1]>=20,
       [value_1]=BLANK()&&[value_2]>=20
   ),
   1
)

I think i stated the problem wrong? Im in the "transform Data" section and OR is not being accepted. I am trying to create a custom column to achieve the task

Power query editor

hi @PCStrouble 

the previous code is for calculated column with DAX. 

 

in Power Query, please try

1) replace all null with 0

2) create a custome column like:

= Table.AddColumn(#"Replaced Value1", "Custom", each if
[Value_1]>=20 or ([Value_1]=0 and [Value_2]>=20)
then 1
else 0)

 

it worked like:

FreemanZ_0-1681559464257.png

 

PCStrouble
New Member

I am by no means a software engineer, coder, at all good with this

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.