Forum Discussion

arielfilipa's avatar
arielfilipa
Advocate I
9 years ago
Solved

Year-To-Date Calculation

Hi,   I have a raw data with the information per Yearmonth divided between priorities and with a Created sum.                                                       ...
  • v-haibl-msft's avatar
    9 years ago

    arielfilipa

     

    It seems that you created a calculate column for the YTD. To make it changed based on the selection, you need to create a calculated measure with following formula.

     

    YTD_Measure = 
    VAR RowDate =
        CALCULATE ( MAX ( 'YTD'[Yearmonth] ) )
    RETURN
        CALCULATE (
            SUM ( 'YTD'[Created] ),
            FILTER (
                ALLSELECTED ( 'YTD' ),
                'YTD'[Yearmonth] <= RowDate
                    && YEAR ( 'YTD'[Yearmonth] ) = YEAR ( RowDate )
            )
        )
    

     

    Best Regards,
    Herbert