Forum Discussion

Eyal's avatar
Eyal
Icon for Helper II rankHelper II
8 years ago
Solved

Measure to calculate based on previous data point.

  Hello, I need to multiply to parameters. One of which is sampled every 3 days and I need to use the previse sampled point for today calculation until a new sample point arrive, (See screen clip). ...
  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    8 years ago

    Hi Eyal

     

    Following DAX formula will do the job

    Product Of Day Parameters=
    VAR PreviousSample =
        IF (
            ISBLANK ( Table1[Sample] ),
            CALCULATE (
                LASTNONBLANK ( Table1[Sample], Table1[Sample] ),
                FILTER ( Table1, Table1[Day] < EARLIER ( Table1[Day] ) )
            ),
            Table1[Sample]
        )
    RETURN
        Table1[PARA2] * PreviousSample