Forum Discussion
Highlight specific rows in a table visual that meets a condition
- 6 years ago
Try wrapping the prevdayfilter column in a selectedvalue(). Even if there is just 1 value and 1 column in a table you still cant refer directly to the table, instead you need to do an aggregation on the column to get the appropriate value.
highlightRow = VAR Filter = SELECTEDVALUE( prevDayFilter[Column] ) Return IF (SELECTEDVALUE(genscape_maintenance_events[updateDate]) >= Filter, 1,0)
/ J - 6 years ago
Just choose select the column you want the table sorted by, then apply either asc or desc sorting:
Whatever settings you have applied when you publish to Power BI Service will be the default for the users when they access the report.
/ J
Hi tex628 : Thanks for sending the file. I opened it in my desktop env. I have February edition as mentioned earlier. It worked in my env. I am trying to follow it for my issue.
I have a query, prevDayFilter as below:
= "'" & Date.ToText(Date.AddDays(Date.From(DateTime.LocalNow()), -1),"yyyy-MM-dd") & "'"
As I try to create the measure
highlightRow = IF (SELECTEDVALUE(genscape_maintenance_events[updateDate]) >= prevDayFilter, 1,0)
to use in the Rules for the background color for the rows
I get error: "DAX comparison op do not supprot comparing valies of type Date with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values."
I tried few things, not working! Any help will be highly appreciated! 🙂
Hi tex628 : I tried to simplify the first query, prevDayFilter as
= Date.AddDays(Date.From(DateTime.LocalNow()), -1)
so that it's a date like 9/3/2020, but I get issue with the measure now:
"The expession return multiple columns. Multiple coulumns can not be converted to a scala r value."
This was an attempt, but didn't work! 😞
- tex6286 years ago
Community Champion
Did you add prevDayFilter as a 1 row table?
/ J- Anonymous6 years agoNot applicable
Hi tex628: I created 'prevDayFilter' as a blank query in Power Query, then renamed it. I created the measure on the 'maintenance summary table' data source and use the prevDayFilter query! The measure is supposed to check ' updateDate' on each row in the 'maintenance summary table' to decide whether to highlight the row, etc. Not sure what to do! 😞
- tex6286 years ago
Community Champion
Try wrapping the prevdayfilter column in a selectedvalue(). Even if there is just 1 value and 1 column in a table you still cant refer directly to the table, instead you need to do an aggregation on the column to get the appropriate value.
highlightRow = VAR Filter = SELECTEDVALUE( prevDayFilter[Column] ) Return IF (SELECTEDVALUE(genscape_maintenance_events[updateDate]) >= Filter, 1,0)
/ J