Forum Discussion
Frixel
9 months agoPost Prodigy
Error in create measure for filter
Hello, I try to make a filter for multiple filters(42) and create this measure but it gives this error. What is the problem? also created this
- 9 months ago
Hi Frixel
you cant use a column directly in a measure like that.the formula that you have shown in screenshot will work for new column not new measure.
try below :
Filter DC= IF( MAX('ontvangen'[From] )="[email protected]", TRUE(), FALSE() )Filter DC= IF( SELECTEDVALUE('ontvangen'[From] )="[email protected]", TRUE(), FALSE() )Please give Kudos or mark it as solution once confirmed.
Thanks and Regards,
Praful
rohit1991
9 months agoSuper User
Hii Frixel
The error appears because you are trying to use a column that is created as a measure (Filter DC) inside a row-level filter of CALCULATE().
Power BI does not allow using measures in a TRUE/FALSE filter expression only columns can be used.
So this:
'... ontvangen'[Filter DC] = TRUE()
fails because Filter DC is a measure, not a column.
If you want to filter rows, you must create a calculated column instead:
Filter DC Column =
IF ( '... ontvangen'[YourCondition] = "Something", TRUE(), FALSE() )
Then use it in your measure:
DC_Filter =
CALCULATE (
COUNTROWS ( '... ontvangen' ),
'... ontvangen'[Filter DC Column] = TRUE()
)
This is the only valid way a measure cannot be used as a row filter in CALCULATE().