Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

DAX Variable + Selected Value with Date and Time

Hi together, I got an issue with this Dax-Formula. The part with the variable and SelectedValue is not working. I am selecting the value in a visual table. The format of the Selected Value is dd/mm/...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    If you want to set a dynamic flag for rows based on the date period selected in slicer, I'd suggest you firstly add a new Date table:

    Date Slicer = CALENDAR(MIN('Data'[TimestampFrom]),MAX('Data'[TimestampTo])+1 ) 

    Then modify your measure like:

    InDateTimeRange = 
    var _rangeStart= MIN('Date Slicer'[Date])
    var _rangeEnd= MAX('Date Slicer'[Date])
    return
    IF(MAX(Data[TimestampFrom]) >= _rangeStart&& MAX(Data[TimestampTo]) <= _rangeEnd&& MAX(Data[TimestampTo]) <>BLANK(), 1, 0)

    Output:

     

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