Forum Discussion

PeterHorvath's avatar
PeterHorvath
New Member
3 years ago
Solved

Apply filter on measure

Hello,

 

I have a measure object on the page. It is the number of non blank elements in a particular column.

In addition, I use page filter. This filter does not have any effect on the measure.

 

What do I need to do if I 'd like the measure be filtered?

Do I need to do programming or just set something in order to get it work?

 

Thank you in advance

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi PeterHorvath ,

     

    Maybe you used ALL function in your measure. For example, sample data is as follows.

    Measure = CALCULATE(SUM('Table'[Value]),ALL('Table'))

    The ALL function returns all the rows in a table, or all the values in a column, ignoring any filters that might have been applied. 

    You could use ALLSELECTED function instead of ALL. The ALLSELECTED function removes context filters from columns and rows in the current query, while retaining all other context filters or explicit filters.

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

2 Replies

  • PeterHorvath , a measure should take filters from the same and connected table (direction of filter it toward that table)  using slicer/filter/dill, etc

     

    Unless you are using all, removefilter in the measure

     

    If this does not help
    Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi PeterHorvath ,

     

    Maybe you used ALL function in your measure. For example, sample data is as follows.

    Measure = CALCULATE(SUM('Table'[Value]),ALL('Table'))

    The ALL function returns all the rows in a table, or all the values in a column, ignoring any filters that might have been applied. 

    You could use ALLSELECTED function instead of ALL. The ALLSELECTED function removes context filters from columns and rows in the current query, while retaining all other context filters or explicit filters.

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.