Filter Power BI visualisation based on multiple column values

Viewed 363

I'm very new to Power BI so apologies if this is an obvious question...

I have a visualisation of a table on my report and I want to filter only this visualisation based on 1 columns of 'Table A', 'Category', and 'Days Elapsed', a DAX measure I have made.

I want it to show records if they are category 'A' AND 'Days Elapsed' <30, OR if they are category 'B' and 'Days Elapsed' <10

eg. this table: Before filtering would become this table: After filtering

This would be quite simple to do in Python but as I'm new to DAX measures this is confusing me quite a bit- not sure if I need a new measure or a calculated column.

1 Answers

You can create a measure that applies the filter on the table and count the rows.

Measure = 
    COUNTROWS(
        FILTER(
            'Table A',
             ([Category]="A" && [Days Elapsed]<30) || 
             ([Category]="B" && [Days Elapsed]<10)
        )
    )

Keep in mind Measure are computed at runtime, you can do something similar with a calculated column and materialize the filter to make it easier to understand.

Calculated Column = IF(([Category]="A" && [Days Elapsed]<30) || ([Category]="B" && [Days Elapsed]<10),1)

Then you can filter when that column is 1.

Related