Forum Discussion

AishwariyaV's avatar
AishwariyaV
Helper IV
4 years ago
Solved

DAX help

Hi all, I have one scenario where i have to find the maximum date and when there is no maximum date, it has to consider previous max date. Date Date2 Max date 12-01-2021 10-14-2021 12-16-...
  • v-luwang-msft's avatar
    4 years ago

    Hi AishwariyaV ,

    Test the measure like the below:

    outputvalue = 
    var test=MAXX (
    FILTER (
    ALL ( Sheet1 ),
    Sheet1[Date]= max(Sheet1[Date])
    && format(Sheet1[Date],"YYYYMM")>=format(Sheet1[Date2],"YYYYMM")
    ),
    Sheet1[Date2]
    )  return CALCULATE(MAX(Sheet1[Value]),Sheet1[Date2]=test)

    Output:

    Did I answer your question? Mark my post as a solution!


    Best Regards

    Lucien