Forum Discussion
Calculated Measure percent not blank
- 5 years ago
You need to upgrade to the March 2021 version of Power BI Desktop. It supports multiple columns now.
If you cannot, use this measure:CALCULATE( COUNTROWS( 'Table' ), FILTER( ALL( 'Table'[MVA?], 'Table'[Insurance 1], 'Table'[Insurance 2] ), 'Table'[MVA?] = TRUE() && ( 'Table'[Insurance 1] ) <> BLANK() || 'Table'[Insurance 2] <> BLANK() ) )But you should be on March 2021 if possible. Only do the above if your IT overlords are evil, or you are on Report Server, which will get this feature in May I think. 😁
I'm not sure what you are trying to do, but FILTER with ALL on a column is just fine. In fact, when you type:
CALCULATE(
Expression,
Table[Field] = 1
)
DAX is doing this in the background:
CALCULATE(
Expression
FILTER(
ALL(Table[Field]),
Table[Field] = 1
)
)
When I gave you the FILTER with ALL() in the 3 columns, that is the same thing - the exact same thing as the Calculate above with 3 conditions - and that is the point - they are't conditions at all, they are all tables! The predicate Table[Field] = 1 is converted to the FILTER() function by DAX to do the work. It is just syntax sugar to make typing the filters easier.
Doesn't mean what I gave you will work for your situation, but there is nothing wrong with what I did. Using FILTER with ALL for a table is what can cause performance issues, but I filtered columns, not a table.
The March 2021 update just enhances the syntax sugar to allow 2+ columns to be referenced without having to resort to using FILTER with ALL for 3 columns, but performance is the same, because DAX is really creating the larger measure I gave you to do the work.
edhans thank you for your time and help, Ed! It worked 🙏
- edhans5 years ago
Community Champion
Great Anonymous ! Glad I was able to assist, and hopefully show that using FILTER with ALL on a column(s) is fine. It is on a table that it can hit performance issues and is generally not a good practice.