I'm trying to highlight points in a PowerBI report based on user input, based on http://sqljason.com/2018/03/highlighting-scatter-charts-in-power-bi-using-dax.html
My work so far is available at https://github.com/turbomam/measureIntoColumn/blob/master/mtminimal.pbix
My input data (Sheet1
) consists of three columns: the name of a car, its fuel economy (mpg) and its engine displacement.
I have created another table (CarNames
)
CarNames = SUMMARIZECOLUMNS(Sheet1[carname])
And added a measure to indicate the selected car
SelectedCar = SELECTEDVALUE(CarNames[carname])
I have added the following to my report (counter-clockwise from upper right):
- a scatter plot of the fuel economy vs. engine displacement
- a slicer based on
CarNames[carname]
- a card that confirms the values of the
CarNames[SelectedCar]
measure
Now I would like to highlight (not filter) the user-selected car on the scatterplot.
I thought I could create a new Boolean column for every row of Sheet1
by testing Sheet1[carname]
against CarNames[SelectedCar]
. Then I could use that Boolean value in the legend slot for my scatterplot and get a different color for the selected car.
CarSelected = if(Sheet1[carname] = CALCULATE(CarNames[SelectedCar]), TRUE, FALSE)
But when I go to the table viewer, all of the Sheet1[CarSelected]
values are FALSE