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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
elainepowell
Frequent Visitor

Power BI Replace if multiple conditions

There's duplicate AD data that I need usable.

 

If there's a specific city name and it's within TX district, I want to add TX to it.

This requires checking for the city name from one column and checking for TX in the district column.

 

Table.ReplaceValue(
#"previous",
each [AD.physicalDeliveryOfficeName],
each if [AD.physicalDeliveryOfficeName] = "City" and {"AD-person.district"} = "TX"
then "City TX"
else [AD.physicalDeliveryOfficeName],
Replacer.ReplaceText, {"AD.physicalDeliveryOfficeName"}
)

 

It's not working.

Anyone know how I can fix this?

1 ACCEPTED SOLUTION
elainepowell
Frequent Visitor

It looks like it was a glitch with the name of the second column.

On a whim, I renamed the column and now the replace works.

View solution in original post

3 REPLIES 3
elainepowell
Frequent Visitor

It looks like it was a glitch with the name of the second column.

On a whim, I renamed the column and now the replace works.

Greg_Deckler
Super User
Super User

@elainepowell Any chance you can paste some sample data as text?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

The dataset is awkward, but maybe this will work?

AD.physicalDeliveryOfficeNameAD-person.district
Lake StevensWA
College StationTX
LoganUT
MurrayUT
KirklandWA
CityTX
CityOR
BellinghamWA
LancasterCA
StocktonCA
Santa RosaCA
Van NuysCA
PompanoFL
KendallFL
EverettWA
AlbuquerqueNM
El CentroNM
CityTX
CityOR
VisaliaCA
ClovisCA
NovatoCA
MercedCA
San FranciscoCA
LivermoreCA
Miami LakesFL
N MiamiFL
Staten IslandNY
BrooklynNY
YonkersNY
Port ChesterNY
Boca RatonFL
Auburn HillsMI

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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Kudoed Authors