Forum Discussion

GeorgiBarov's avatar
GeorgiBarov
Frequent Visitor
8 years ago
Solved

Average YTD by category

Hi guys, How can I calculate the average year to date Quantity by Assay? I have table like:   Oid Assay Quantity Date 1 As 0.574633 1/1/2016 0:00 2 Ag 8563.638 1/2/2016 0:00 ...
  • v-piga-msft's avatar
    8 years ago

    Hi GeorgiBarov

     

    You could try to create the measure below to get your desired output.

     

    average_ytd =
    TOTALYTD (
        AVERAGE ( demo[Quantity] ),
        'Table'[Date],
        FILTER ( ALL ( demo ), 'demo'[Assay] = MAX ( 'demo'[Assay] ) )
    )

    The output is below.

     

     

    If you need additional help please share your expected output.

     

    Best Regards,

    Cherry