locked
DAX: Max date last month RRS feed

  • Question

  • Hello,

    I need to find sales amount of the max day on the previous month in DAX.
    The date can be 31 or 30 or even 15, any last day in the table.
    This is that I am trying to do but I get all the values smaller then current month and not the max date:

    amount:=CALCULATE(sum([amount]),FILTER(Fact,[date]=LASTDATE(FILTER (CALCULATETABLE (VALUES ('Fact'[date])), 'Fact'[date] <= eomonth(today(),0)))))

    How can I fix it?

    Thanks!


    Thursday, March 20, 2014 1:05 PM

Answers

  • Hello,

    You should use -1 as parameter for EOMonth function to get the last date of the previous (= -1) month:

    LastDayPreviousMonth:=CALCULATE(LASTDATE(Tabelle1[DateValues]), Tabelle1[DateValues] <= EOMONTH(TODAY(), -1))


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Marked as answer by Sasha R Thursday, March 20, 2014 2:06 PM
    Thursday, March 20, 2014 1:29 PM