Forum Discussion

LisaB's avatar
LisaB
Helper III
7 years ago
Solved

Today compared to same day last year

Hi everyone,   I have a measure showing order value for today:   OrderValueToday = CALCULATE(SUM(PostedSalesInvoices[Amount]);PostedSalesInvoices[Order_Date] = TODAY())                        ...
  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi LisaB,

     

    I suppose that PostedSalesInvoice table is connected to the calendar table by posting date. You can either change the relationship by connecting to the order date or you can create a new inactive relationship between calendar date and order date.

    Then you can write a measure as below:

     

    OrderLY =
    CALCULATE (
        CALCULATE (
            SUM ( PostedSalesInvoices[Amount] ),
            USERELATIONSHIP ( PostedSalesInvoices[Order_Date], CalendarDate[Date] )
        )
            + SUM ( SalesOrderList[Amount] ),
        SAMEPERIODLASTYEAR ( CalendarDate[Date] ),
        CalendarDate[SameDayLY] = TRUE ()
    )

    I hope you can solve now!

     

    Chiara