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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Baconbomb
Helper I
Helper I

Change value based on value in other column

Hi.

I have a column where i want to change the value IF its blank or # and if the value in a different column is NOT "x" or "y" or "z"

 

To explain it a little better.

So the column i want to change is a list of countrys and from our DB that some times displayes as # or empty.

So i want to change this to a new calculated column only if the data from a different column is not X or Y or Z

 

I tried doing a DAX formula but gave up after a couple of hours.

Any ideas on how to do it or to point me in the right direction. 

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Baconbomb,

 

You may refer to the following DAX that adds a calculated column.

Column =
IF (
    Table1[Column1] IN { "", "#" }
        && NOT ( Table1[Column2] IN { "x", "y", "z" } ),
    TRUE (),
    FALSE ()
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-chuncz-msft
Community Support
Community Support

@Baconbomb,

 

You may refer to the following DAX that adds a calculated column.

Column =
IF (
    Table1[Column1] IN { "", "#" }
        && NOT ( Table1[Column2] IN { "x", "y", "z" } ),
    TRUE (),
    FALSE ()
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft

Maybe im missing something or its the way my data is formulated but here is the "translation" of your formula that i made and i get an error

Country =
 IF(
     'All trafik Nat, roam och data'[Land/Country]={"";"#"} 
        && NOT 'All trafik Nat, roam och data'[Call Descr]={"I utländska 
        nät";"GPRS/3G i utlandet";"Till fastnät utomlands";"SMS till utlandet";"Till 
        mobil utomlands"};
    "Sweden";
    'All trafik Nat, roam och data'[Land/Country])

A table of multiple values was supplied where a single value was expected.

@Baconbomb,

 

Notice the IN operator above.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Missed them. Now it works.

 

Thanks for the help.

jthomson
Solution Sage
Solution Sage

Sounds like it's a job for a conditional column in Power Query, doing it backwards to how you describe - have your new column equal the country column if the third column equals x, y or z, then what you've got left are just the entries that you would want to change, you can then have it look at the value of the country column and change it as necessary for each instance (#, blank) you need to, having it maintain the value of the country column at the end for those where you don't need to change it.

A few remarks:

 

First, you don't mention what the changed value should be.

 

Second, if a column is added, then this column will be populated with values for all rows.

So you need to define what the value would be if the condition is met and what the value would be if the condition is not met.

 

Is Power Query OK or do you need DAX?

Specializing in Power Query Formula Language (M)

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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