Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to get same day value from previous years

Hello all, I have two tables one with a production value from previous 5 years and a datetable. I would like to show a same day same month value in every year compared with cuurent day.  The values...
  • Greg_Deckler's avatar
    6 years ago

    Anonymous - Sure,

     

    1. Create a disconnected date table like this: 
      Production Dates = DISTINCT('Table'[Production Date])
    2. Create a measure like this: 
      Measure =
      VAR __CompareDate = MAX('Production Dates'[Production Date])
      VAR __Date = MAX('Table'[Production Date])
      RETURN
      IF(DAY(__Date) = DAY(__CompareDate) && MONTH(__Date) = MONTH(__CompareDate),1,0)
    3. Now use that measure in a Filter on your table like image below

    I have attached a PBIX if it helps. Below my sig.