Forum Discussion

pawelj795's avatar
pawelj795
Post Prodigy
5 years ago
Solved

Count Items which occurs again

Hi, I need to create 2 measures. The first one should count how many items occur again today. The second one should tell how many times this particular item occur in the past.   Sample data be...
  • v-xuding-msft's avatar
    5 years ago

    Hello @pawelj795 ,

    Please try this:

    Measure 1 = 
    var t1_= 
        CALCULATETABLE (
            VALUES ( 'Table'[Item ID] ),
            FILTER (
                ALL ( 'Table'[Date] ),
                'Table'[Date] < MAX('Table'[Date]) )
            )
    var t2_= 
        CALCULATETABLE (
            VALUES ( 'Table'[Item ID] ),
            FILTER (
                ALL ( 'Table'[Date] ),
                'Table'[Date] = MAX('Table'[Date]) )
            )
    return
    COUNTROWS(INTERSECT(t1_,t2_))
    Measure 2 = CALCULATE(COUNT('Table'[Date]),ALLEXCEPT('Table','Table'[Item ID]))