Forum Discussion

Pentanol's avatar
Pentanol
Frequent Visitor
8 years ago
Solved

Time Intelligence DTD

Hi all, I searched for this and couldn't find any similar to my situation. I'm tracking a competitors price for all similar products every day as well as our own prices. Trying to come up with a cal...
  • Zubair_Muhammad's avatar
    8 years ago

    HI Pentanol

     

    Andrew

     

    Try this solution

     

    First Add a calculated Column which will RANK the dates for each SKU

     

    Date RANK =
    RANKX (
        FILTER ( ALL ( Table1 ), Table1[SKU] = EARLIER ( Table1[SKU] ) ),
        Table1[Date],
        ,
        ASC,
        DENSE
    )

    Now you can get the Change in Difference using this Calculated Column

     

    Change_In_Difference =
    VAR previousDayDifference =
        CALCULATE (
            SUM ( Table1[Comp Price] ) - SUM ( Table1[Our Price] ),
            FILTER (
                ALLEXCEPT ( Table1, Table1[SKU] ),
                Table1[Date RANK]
                    = EARLIER ( Table1[Date RANK] ) - 1
            )
        )
    VAR CurrentDayDifference = Table1[Comp Price] - Table1[Our Price]
    RETURN
        CurrentDayDifference - previousdayDifference
  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    8 years ago

    Pentanol

     

    See the pic below.I just added another SKU to your sample data