Forum Discussion
DateDiff Days giving incorrect result
Hi Dale
My use case is simple we are genereating a report whihc contains calculated column called due dates , that duedates column is calculated
Days Due = View_Compliance[Next Reading Due By]- Today()
So the Days Due calculated column give number days either +/1 with reference to Today()
User asked to to put a paarmeter instaed of Today() so that they can give refernce date instead of today .
what we planned here to achieve this is we are taking seperate datetime table where the user can select data and we are creating measure to take the selectdate and we want to use that measure in Days due calculated column .
Problem here is we are getting result as the refernce date as max value in that new date dimension instaed os what user is selected .
Agree, calculated column is just NOT going to help you. And while it's possible to write the DAX for this in a measure (which is what you should do), I get the feeling that your current data model will make that needlessly complex. I say that based on your statement that the 2 tables in question are not related.
In general, you are going to be looking to use SUMX to interate over the rows. Something like:
Selected Date = MAX(Calendar[Date])
Total Days Due = SUMX(View_Compliance, View_Compliance[Next Reading Due By] - [Selected Date])