Reputation: 61
I am very new to using power bi and I have data that is structured like:
matter | OpenDate | Sales |
---|---|---|
matter1 | 01/01/2021 | 5000 |
matter2 | 01/01/2018 | 2000 |
matter3 | 01/01/2018 | 0 |
matter4 | 01/01/2020 | 0 |
I need to filter the table to include any item that has positive sales or an OpenDate later than 2019. So, once my filter is applied, the table would include matter1, matter2, and matter4.
I am trying to a function that I can use to filter. I started with the date piece and wrote:
NewerMatter = IF(MAX('Matter Detail'[OpenDt])>DATE(2019,01,01),1,0)
When I try to include this field in my table, I get an error that says there is not enough memory to complete this operation. I would greatly appreciate any thoughts on how to accomplish this filter whether it is through fixing the dax I already wrote or through built-in functionality.
Upvotes: 0
Views: 3711
Reputation: 4015
You can add a simple measure like this:
Measure :=
IF (
YEAR ( SELECTEDVALUE ('Table'[OpenDate] ) ) >= 2019
|| SUM ('Table'[Sales] ) > 0,
1
)
It checks each table row for whether the year-component of the OpenDate
column is greater than or equal to 2019 OR if the Sales
column is greater than 0 - if any of those are true, the measure returns 1
, else it returns a blank.
You can use this as a filter in your table visual:
Upvotes: 1