Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Prior Days Sales (not previous day)

I could use help with a formula…I am trying to write a formula that totals the priors days sales when the prior day is not the previous day.  I have tried numerous variations of DAX formulas like bel...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Try something like this to get the previous date:

    VAR latestDate = MAX('Fact'[SalesDate])
    VAR prevDate = CALCULATE(MAX('Fact'[SalesDate]),'Fact'[SalesDate]<latestDate)
    RETURN
    CALCULATE(
    [Sales],
    'Date'[Date]=prevDate
    )