Forum Discussion

toum's avatar
toum
Helper II
3 years ago
Solved

Max date

Please I need your help on this, I need to create a measure to calculate the max date of a table that is between two other dates (Date Slicer) so for example, if in my slicer I chose a date between...
  • v-yueyunzh-msft's avatar
    3 years ago

    Hi , toum 

    According to your description, you want to create a date slicer and you need to get the max date in table in the selected date range you selected.

    Here are teh steps you can refer to :
    (1)This is my test data:

    (2)We can click "New Table" to  create a date table as a slicer:

    Date SLicer = CALENDAR(FIRSTDATE('Table'[Date]) , LASTDATE('Table'[Date]))

    (3)Then we can create a measure :

    Max Date = var _min_date = MIN('Date SLicer'[Date])
    var _max_date = MAX('Date SLicer'[Date])
    var _t = FILTER(ALLSELECTED('Table') ,'Table'[Date]>=_min_date && 'Table'[Date]<= _max_date)
    return
    MAXX(_t ,[Date])

    (4)Then we can put the filed we need on the visual and then we can meet your need the result is as follows:

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly