Forum Discussion
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
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
9 Replies
- rohit1991Super 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().
- Praful_PotphodeSuper User
Hi Frixel
Try Below Measure:
# DC_Filter = CALCULATE( COUNTROWS('ontvangen'), FILTER( 'ontvangen', [Filter DC] = TRUE() ) )Please give kudos or mark it as solution once confirmed.
Thanks and Regards,
Praful
- FrixelPost Prodigy
yes i can create that measure but when i then create the filter in ....ontvangen then this error.
And the 'From' is not inserted by power bi but by myself.
- Praful_PotphodeSuper User
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
- FrixelPost Prodigy
- rohit1991Super User
Hii Frixel
Your calculated column must be a pure row-level expression, for example:
Filter DC Column = IF ( '… ontvangen'[SomeColumn] = "Something", TRUE(), FALSE() )- must reference only columns
- must not use measures
- must evaluate per row
Once the column becomes a valid boolean column, this measure will work without error:
- v-hjannapuCommunity Support
Hi Frixel,
I would also take a moment to thank Praful_Potphode , rohit1991 for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
Regards,
Community Support Team.- v-hjannapuCommunity Support
Hi Frixel,
I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We are always here to support you.
Regards,
Community Support Team.