Forum Discussion
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")
Hi Do5779 ,
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.
5 Replies
- v-chenwuz-msftCommunity Support
Hi Do5779 ,
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.
- Do5779Helper II
Hi v-chenwuz-msft,
yes this should work, but unfortunately there is no attachment. Can you please add it?
- v-chenwuz-msftCommunity Support
- Do5779Helper 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.
(I didn't find the tag to upload the report π€)- Do5779Helper II
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")
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...