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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Do5779
Helper II
Helper II

Compare value to coloumn

Hi experts, 

 

my problem is the following one:

 

I have a map with some locations in power bi, which were sucessfully displayed. Now I would like to use the auto zoom and change the colour of the selected location. The rest of these have to be displayed all the time, too.
So I created the same location table twice and put it into the visual. 

 

Now I need the switch "if the selected value of the location (Lacation Table 1 with the slicer) is equal to the the row of Location2 (second location table) then green, otherwise blue" (At the code shown as Var1 = Location2[Address] ) in a measure to use it in the visual.
 

 

But I don't get the right idea. Can you pleas help me😞 (I tried it with calculated and lookupvalue, but it wasn't working)

 

Measure:

 

Colour= var Var1 = Location1[Address]

return

switch (true(), 1=2,
Var1 = Location2[Address]

"green","BLUE")

 

 

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

Hi @Do5779 ,

 

vchenwuzmsft_0-1663654319021.gif

Is this above you want?

 

If yes, please refer the pbix in the attachment. if no, please provide some example data and expect result.

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

5 REPLIES 5
Do5779
Helper II
Helper II

@v-chenwuz-msft: Your report works fine with the countrys, but what if I want e.g. to change countrys to Gross Sales, I dont get the desired result. Fore Example for the gross Sales 1799 only Canada should be green and the rest is blue, but no colour change. My question is because in my fault I have Ids with addresses and this is nearly the same. 

Do5779_0-1663747861847.png

Do5779_1-1663747874550.png


(I didn't find the tag to upload the report 🤔)

Here is the solution as a Video, but in my case it wont work.

DAX Fridays! #212: VALUES vs SELECTEDVALUE to conditional format a line chart - YouTube


For a Test I did it how it was explained and it works:

Test4 = 

var selectvalue = VALUEs(Abfrage1[id])

return
If(selectedvalue(Tabelle[ID]) in selectvalue, "y" , "n")

Do5779_1-1663770772816.png
but for the real data with the same code:

Test4 = 

var selectvalue = VALUEs('Abfrage1'[Index.1])

return
If(SELECTEDVALUE('Member'[Index.1]) in selectvalue, "y" , "n")


I get only "y" as the results...





Do5779_0-1663770745419.png

 



v-chenwuz-msft
Community Support
Community Support

Hi @Do5779 ,

 

vchenwuzmsft_0-1663654319021.gif

Is this above you want?

 

If yes, please refer the pbix in the attachment. if no, please provide some example data and expect result.

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

Hi @v-chenwuz-msft,

 

yes this should work, but unfortunately there is no attachment. Can you please add it?

Hi @Do5779 ,

 

Sorry, I forgot. It has been added.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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