Forum Discussion
Relative Day DAX
- 9 years ago
v-huizhn-msft Well I found the solution, here it is :)
Relative Day Number = IF('Dates'[Date]> TODAY();(DATEDIFF(TODAY();'Dates'[Date]; DAY ));-1 *(DATEDIFF('Dates'[Date];TODAY(); DAY )))Thank you for your help
Hi Asma,
Please try create a calculated column using the formula.
Relative day Number=IF(Dates[Date]=NOW(),0,IF(Dates[Date]>NOW(),1,-1))
If this doesn't resolve your issue, please share your sample data for further analysis.
Best Regards,
Angelia
- Asma9 years agoFrequent Visitor
@v-huizhn-msft Hi Angelia, thank you for your help but unfortunately your solution didn't work for me for the sample reason that my data has many years, and I want the relative Day number to be counted for any day of any year... Not only for the previous and the next days.
for exemple if the date of Today is 09/03/2017 and the day chosen is 09/03/2016 than Relative day Number = -365 .... and so on....
here a part of my database
Best Regards,
Asma
- Asma9 years agoFrequent Visitor
v-huizhn-msft Well I found the solution, here it is :)
Relative Day Number = IF('Dates'[Date]> TODAY();(DATEDIFF(TODAY();'Dates'[Date]; DAY ));-1 *(DATEDIFF('Dates'[Date];TODAY(); DAY )))Thank you for your help