Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Count with All filter

I have a single table which contains the following:   Part     Added_Date     The question is:  1.  I want to see when we are entering a part for the first time, but I need it narrowed down to ...
  • v-jiascu-msft's avatar
    v-jiascu-msft
    7 years ago

    Hi Anonymous,

     

    Try this one please.

    Measure =
    VAR existedBefore5 =
        CALCULATETABLE (
            VALUES ( Table1[Part] ),
            FILTER ( ALL ( Table1 ), Table1[Added_Date] <= TODAY () - 5 )
        )
    VAR amount =
        CALCULATE (
            COUNT ( Table1[Part] ),
            FILTER ( 'Table1', NOT Table1[Part] IN existedBefore5 )
        )
    RETURN
        IF ( ISBLANK ( amount ), BLANK (), IF ( amount <= 5, amount, 9999 ) )
    //9999 could be 0 or blank()
    

     

    If it works, please mark it as an answer.

     

    Best Regards,

    Dale