Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Keepfilters

hello every body, 

    im new in power bi and dax , 

avg = AVERAGEX(
KEEPFILTERS(VALUES(table[column1])),
CALCULATE(MIN(table[column2]),NOT(ISBLANK(table[column3])))
)
can you explain to me this measure, with a focus on keepfilters and values , is keep filters in that case like group by and what is the role of the values inside the keepfilters.
thanks you 

2 Replies

  • Icey's avatar
    Icey
    Community Support

    Hi Anonymous ,

    VALUES ( 'Table'[Column1] )’ returns a one-column table that contains the distinct values from Column1.

    ‘CALCULATE ( MIN ( 'Table'[Column2] ), NOT ( ISBLANK ( 'Table'[Column3] ) ) )’ returns each group’s minimum value, for example, A, B and C.

    In your measure, ‘KEEPFILTERS’ and ‘VALUES’ play the same role. ‘KEEPFILTERS’ is not needed in this measure.

    avg =
    AVERAGEX (
        KEEPFILTERS ( VALUES ( 'Table'[Column1] ) ),
        CALCULATE ( MIN ( 'Table'[Column2] ), NOT ( ISBLANK ( 'Table'[Column3] ) ) )
    )
    avg 2 = 
    AVERAGEX (
        VALUES ( 'Table'[Column1] ),
        CALCULATE ( MIN ( 'Table'[Column2] ), NOT ( ISBLANK ( 'Table'[Column3] ) ) )
    )

     

    Best Regards,

    Icey

     

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Icey  thank you its was clear for me, i did the same think i took off the Keepfilters and the result stay the same , if you mind if you have a tips or an equivalent of SQL groupby in dax .