Forum Discussion
Power BI Equivalent to SQL OR condition
- 5 years ago
Interesting problem. A calc column won't work if you want the user to select the value. You will need to basically build a Union query to create the filter table and then return a result in a measure. You can place the measure in the table visual or possibly in the visual filters pane (if you don't want to see it in the table). This should return 1 if the row meets the criteria it assumes your visual has some row level primary key (or combination of columns that make it a pk)
Show = COUNTROWS ( DISTINCT ( UNION ( FILTER ( table, table[date1] >= DATE ( 2020, 1, 1 ) ), FILTER ( table, table[date2] >= DATE ( 2020, 1, 1 ) ) ) ) )
Interesting problem. A calc column won't work if you want the user to select the value. You will need to basically build a Union query to create the filter table and then return a result in a measure. You can place the measure in the table visual or possibly in the visual filters pane (if you don't want to see it in the table). This should return 1 if the row meets the criteria it assumes your visual has some row level primary key (or combination of columns that make it a pk)
Show =
COUNTROWS (
DISTINCT (
UNION (
FILTER ( table, table[date1] >= DATE ( 2020, 1, 1 ) ),
FILTER ( table, table[date2] >= DATE ( 2020, 1, 1 ) )
)
)
)