Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Dynamic Previous Months Data

Hi All, I have a Separate date table in power BI with name "Date", I have columns Date, Year, Month , quarter in that table I have another table Content I have made relation of date table Date c...
  • Greg_Deckler's avatar
    3 years ago

    Anonymous You can use EOMONTH for this kind of thing. For example:

    1 Month Ago Measure = 
      VAR __Date = MAX( 'Dates'[Date] )
      VAR __MaxDate = EOMONTH( __Date, -1 )
      VAR __MinDate = DATE( YEAR( __MaxDate ), MONTH( __MaxDate ), 1 )
      VAR __Result = CALULATE( [Some Measure], 'Dates'[Date] >= __MinDate && 'Dates[Date] <= __MaxDate )
    RETURN
      __Result

    Also, this may help as well: