Forum Discussion

darko861's avatar
darko861
Icon for Resolver II rankResolver II
2 years ago
Solved

Select Correct Date Range in Card

Hi Community,   I have the following pbix file. https://www.dropbox.com/scl/fi/30tn682n98oacda3wu4y4/TestData.pbix?rlkey=j3si9f97vgx9i3268tsk5jhhd&dl=0   It's a test dataset with mock values. I ...
  • darko861's avatar
    2 years ago

    Hi Guys,

     

    It wasn't as straightforward as one might think, but I managed to tweak the DAX using this measure:

     

    Test =
    VAR __dt = MAXX(FILTER(ALL(DimDate),DimDate[Latest Date]="Latest"),DimDate[Date])
    RETURN
        MAXX(
            FILTER(
                VALUES( TrainDate ),
                TrainDate[startdate] <= __dt && __dt < TrainDate[enddate]
            ),TrainDate[name] & " - " & TrainDate[StartDate] &" - " &TrainDate[EndDate])
     
    It works really great now, and the card visual will get updated dynamically as soon as a new test is performed with a different timeframe.