Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Timeperiod from today

Hello all,
can someone help me how to create a dynamic sum by Measuere? This should always be the sum of the last 7 days of our sales are drawn? The same for the last 4 weeks and the last half year, starting point should always be the current day.

 

Regards

  • Anonymous 

    The starting date can be

     

    VAR LastDayWithSales = MAX ( Sales[Order Date] )

    then you return the sales amount adjusting the filter context. For example 

    RETURN

    CALCULATE (

        SUM ( Sales[Sale Amount] ),

        'Date'[Date] >= LastDayWithSales - 49

    )

1 Reply

  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

    Anonymous 

    The starting date can be

     

    VAR LastDayWithSales = MAX ( Sales[Order Date] )

    then you return the sales amount adjusting the filter context. For example 

    RETURN

    CALCULATE (

        SUM ( Sales[Sale Amount] ),

        'Date'[Date] >= LastDayWithSales - 49

    )