Forum Discussion
Select Correct Date Range in Card
Hi Community,
I have the following pbix file.
It's a test dataset with mock values. I want to display the time period for the latest test that has been run in a card visual. In this case, the test was performed on 2023-09-01.
The card visual says that the test belongs to the time frame Train 9 - 6/23/2023 - 8/31/2023. This is incorrect. It should belong to the time frame Train 10 - 9/1/2023 - 11/10/2023 as shown in the disconnected table TrainDate below.
The measure I have used is incorrect. I would really appreciate it if you could tweak the measure so that it shows the correct output but also that it's dynamic when a new test is performed. E.g if a test is performed in August then it should be updated accordingly to the Train schedule.
incorrect measure:
Thanks a lot!
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])RETURNMAXX(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.
1 Reply
- darko861
Resolver II
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])RETURNMAXX(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.