Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Filter on aggregated measure

Hello,   I need to use a filter on the aggregation of a column. I need to achieve two things with this filter:  - It should be possible to aggregate the column in different ways, and the filter sh...
  • v-lid-msft's avatar
    6 years ago

    Hi Anonymous ,

     

    We can not make the field filter in page level with an aggregated value, but we can provide a workaround based on your description:

     

    1. create a calculated table to filter:

     

    Filter_N_Articles_Table =
    GENERATESERIES ( 0, SUM ( Tabelle1[n_articles] ), 1 )

     

    2. Then we create measure used in the chart:

    Sum_N_Articles = 
    VAR result =
        SUM ( 'Tabelle1'[n_articles] )
    RETURN
        IF ( result IN FILTERS ( 'Filter_N_Articles_Table'[Value] ), result, BLANK () )

     

    Sum_Error_Articles =
    IF (
        SUM ( 'Tabelle1'[n_articles] ) IN FILTERS ( 'Filter_N_Articles_Table'[Value] ),
        SUM ( Tabelle1[n_errors] ),
        BLANK ()
    )

     

    n_errors_per_article =
    IF (
        SUM ( Tabelle1[n_articles] ) IN FILTERS ( Filter_N_Articles_Table[Value] ),
        DIVIDE ( SUM ( Tabelle1[n_errors] ), SUM ( Tabelle1[n_articles] ), 0 ),
        BLANK ()
    )

     

    3. Then we can use the Value Field of Filter_N_Articles_Table in the Page Level Filter

     

     


    BTW, pbix as attached.

     

    Best regards,

    Community Support Team _ Dong Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.