Forum Discussion
DATEDIFF HELP
FP#00106 27/02/2019
My expression:
I Think you need MEASURES, not COLUMNS.
I have tried to replicate your scenario using data1 and data2 as dates, calculate 2 differente DATEDIFF and then a "FINAL" measure with an IF. Not super-elegant but it seems to be working
www.autodafe.net/tmp/EXAMPLE.pbix
1st I Calculate (Measure) End of Selected Month:EOM = EOMONTH(SELECTEDVALUE(Cal[Date]);0)
then I have 2 differente DATEDIFFsDDIFF1 =DATEDIFF(SELECTEDVALUE(Foglio1[data1]);[EOM];DAY) DDIFF2 = DATEDIFF(SELECTEDVALUE(Foglio1[data1]);SELECTEDVALUE(Foglio1[data2]);DAY)
Then a simple IF takes what's needed:Final = IF(ISBLANK([DDIFF2]); [DDIFF1];[DDIFF2])
6 Replies
- autodafeResolver I
so the question is???
your formula looks correct. Are you creating a new COLUMN or new MEASURE ??- AnonymousNot applicable
Hi autodafe ,
It's a column.
Here's the result:
.
as you can see it does not calculate until the end of the selected month (Date_Demande) - FP#00057
Can you help?
- autodafeResolver I
I Think you need MEASURES, not COLUMNS.
I have tried to replicate your scenario using data1 and data2 as dates, calculate 2 differente DATEDIFF and then a "FINAL" measure with an IF. Not super-elegant but it seems to be working
www.autodafe.net/tmp/EXAMPLE.pbix
1st I Calculate (Measure) End of Selected Month:EOM = EOMONTH(SELECTEDVALUE(Cal[Date]);0)
then I have 2 differente DATEDIFFsDDIFF1 =DATEDIFF(SELECTEDVALUE(Foglio1[data1]);[EOM];DAY) DDIFF2 = DATEDIFF(SELECTEDVALUE(Foglio1[data1]);SELECTEDVALUE(Foglio1[data2]);DAY)
Then a simple IF takes what's needed:Final = IF(ISBLANK([DDIFF2]); [DDIFF1];[DDIFF2])