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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
jonclay
Helper IV
Helper IV

How to use Conditional Format to make a country into ""

Hello

Our database holds lots of addresses with the Country as United Kingdom. I'd like to use Power BI's Conditional Formatting function to make these into blanks. We use the lists extracted via Power BI to mail people, and we simply don't want the country to appear if it's United Kingdom, but we would like the Country to show if it's e.g. Italy or Spain etc.

I've tried creating a Measure using the following criteria, but I don't think it's going to work as it's been running for 20 minutes so far!

Measure = VAR Country = SELECTEDVALUE(contact[address1_country])
RETURN IF(Country="United Kingdom", Country, "")
Does anyone have a better idea as to how I could achieve this?
 
Many thanks
Jon
2 ACCEPTED SOLUTIONS

@jonclay actually, that's the really cool thing about power query (the transform data screen), it will apply that step on all new data that comes in too 🙂

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

View solution in original post

v-henryk-mstf
Community Support
Community Support

Hi @jonclay ,

 

According to your description, using the "replace value" function in power query is a good choice. As long as the data source is successfully connected, the above operations will still be performed automatically after refreshing the data.

vhenrykmstf_0-1632728753425.png

after refersh:

vhenrykmstf_1-1632728881783.png

Or the measure like below:

M =
IF (
    SELECTEDVALUE ( Sheet1[Column1] ) = "United Kingdom",
    MAX ( Sheet1[Column1] ),
    ""
)


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

8 REPLIES 8
v-henryk-mstf
Community Support
Community Support

Hi @jonclay ,

 

According to your description, using the "replace value" function in power query is a good choice. As long as the data source is successfully connected, the above operations will still be performed automatically after refreshing the data.

vhenrykmstf_0-1632728753425.png

after refersh:

vhenrykmstf_1-1632728881783.png

Or the measure like below:

M =
IF (
    SELECTEDVALUE ( Sheet1[Column1] ) = "United Kingdom",
    MAX ( Sheet1[Column1] ),
    ""
)


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you, Henry. Both of those work perfectly!

DataZoe
Employee
Employee

@jonclay It may be easier to

1. go back into "Transform Data"

2. on the "address1_country" column you can right-click it

3. choose "Replace Values"

4. replace "United Kingdom" with null or a space.

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

Thanks @DataZoe 

The only problem with this is that the underlying data gets added to each day, so there will always be new records showing the Country of United Kingdom.

Thank you, Zoe. That works perfectly!

@jonclay actually, that's the really cool thing about power query (the transform data screen), it will apply that step on all new data that comes in too 🙂

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

amitchandak
Super User
Super User

@jonclay ,

You should use this on your measure

 

New Measure= VAR Country = SELECTEDVALUE(contact[address1_country])
RETURN IF(Max(Table[Country]) ="United Kingdom", [Measure], blank())

 

The country is used in grouped in visual  as row/column/axis

@amitchandak 

Thank you for your quick response. However, the [Measure] section towards the end of the statement is causing me a problem. Power BI is underlining it with a squiggly line and saying that Measure cannot be determined.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.