Forum Discussion

cristianml's avatar
cristianml
Icon for Post Prodigy rankPost Prodigy
3 years ago
Solved

FILTER CALCULATETABLE

Hi,

I want to add a FILTER on this calculatetable , filter with: Revenue < 0 

 

__MINX CCI =
VAR V1 =
CALCULATETABLE(
    SUMMARIZE('Rev CCI','Rev CCI'[Contract],"@VALOR_CCI",[CCI],"@VALOR_REV",[Revenue]))
VAR V2 = MINX(V1,[@VALOR_CCI])
RETURN
V2

Where and how Can I add that filter ?

 

Thanks °!

  • Anonymous's avatar
    Anonymous
    3 years ago

    HI cristianml,

    I'd like to suggest you use filter function to package the result table, then you can add condition in it to check and filter on current field values:

    __MINX CCI =
    VAR V1 =
        SUMMARIZE (
            'Rev CCI',
            'Rev CCI'[Contract],
            "@VALOR_CCI", [CCI],
            "@VALOR_REV", [Revenue]
        )
    RETURN
        MINX ( FILTER ( V1, [@VALOR_REV] < 0 ), [@VALOR_CCI] )

    Regards,

    Xiaoxin Sheng

2 Replies

  • MahyarTF's avatar
    MahyarTF
    Icon for Memorable Member rankMemorable Member

    Hi,

    If you want to add the filter to the Measure, you could add it in second part of the CalculateTable as below :

    CalculateTable( Table[, Filter1, Filter2, ...])

    CALCULATETABLE - DAX Guide

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI cristianml,

    I'd like to suggest you use filter function to package the result table, then you can add condition in it to check and filter on current field values:

    __MINX CCI =
    VAR V1 =
        SUMMARIZE (
            'Rev CCI',
            'Rev CCI'[Contract],
            "@VALOR_CCI", [CCI],
            "@VALOR_REV", [Revenue]
        )
    RETURN
        MINX ( FILTER ( V1, [@VALOR_REV] < 0 ), [@VALOR_CCI] )

    Regards,

    Xiaoxin Sheng