Forum Discussion
Dynamic 2 Date Columns Difference
- 1 year ago
Hi sammy339,
Thank you for reaching out to the Microsoft Fabric Community forum.
create a mapping table first like below
DateSelector = DATATABLE("DateName", STRING, "ColumnIndex", INTEGER,{{"Column1", 1},{"Column2", 2},{"Column3", 3}})
DAX Measure:
Date Difference =
VAR SelectedCol1 = SELECTEDVALUE(DateSelector[DateName])
VAR SelectedCol2 = SELECTEDVALUE(DateSelector2[DateName])VAR Date1 = SWITCH(TRUE(),SelectedCol1 = "Column1", 'Projects'[Column1],
SelectedCol1 = "Column2", 'Projects'[Column2],
SelectedCol1 = "Column3", 'Projects'[Column3])VAR Date2 = SWITCH(TRUE(),SelectedCol2 = "Column1", 'Projects'[Column1],
SelectedCol2 = "Column2", 'Projects'[Column2],
SelectedCol2 = "Column3", 'Projects'[Column3])RETURN
IF(ISBLANK(Date1) || ISBLANK(Date2),BLANK(),DATEDIFF(Date1, Date2, DAY))I have included the PBIX file that I created using the provided sample data. Kindly review it and confirm whether it aligns with your expectations.
If this post clears your doubt, please give us Kudos and consider marking Accepting it as a solution to guide other members in finding it more easily.
Best Regards,
Sahasra.
Hi sammy339,
May I ask if you have gotten this issue resolved?
If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.
Thanks.
Hi sammy339 ,
I wanted to check in on your situation regarding the issue. Have you resolved it? If you have, please consider marking the reply that helped you or sharing your solution. It would be greatly appreciated by others in the community who may have the same question.
Regards,
Sahasra.