Forum Discussion
harshad_barge
Helper I
6 years agoDAX incorrectly calculating DATEADD condition
Hi all, I am still discovering DAX and I am incredibly grateful for the support of this forum so far. I have a problem I dont know why i am not getting an output for just a few of the values. I can...
- 6 years ago
Hi harshad_barge ,
If you are simply trying to get the difference in years between two dates, you can just use DATEDIFF().
Position from (Year) = DATEDIFF ( 'Table'[Calculation Date], 'Table'[Position From Date], YEAR )
amitchandak
Super User
6 years agocreate a datediff column in year and month and the use switch true(). Both as column
diff = datediff('Ordinary Hours'[Calculation Date],'Ordinary Hours'[Position From Date],Year)
switch(true(),
diff < 1, "Y1",
diff < 2, "Y2",
diff < 3, "Y3",
diff < 4, "Y4",
diff < 5, "Y5",
diff < 6, "Y6",
diff < 7, "Y7",
diff < 8, "Y8",
diff < 9, "Y9",
"Y10")