Forum Discussion
Anonymous
3 years agoNot applicable
Datadiff returns wrong value
Hi all, I am calculating a simply date difference using Datediff function. But the value I got is wrong. I check the data types of the two date column are date. I still can not find the reason. P...
- 3 years ago
Hi Anonymous
if you change the aggregation from SUM to MAX or MIN you will get correct results at the table visual row level but wrong at the total level.
You have two options.
first option is to create a measure based on the Date Var column that you have createdDifference (days) = SUMX ( SUMMARIZE ( 'Table', 'Table'[Invoice Date], 'Table'[Service/ Tax Date] ), CALCULATE ( MAX ( 'Table'[Date Var] ) ) )or directly using the following measure
Difference (days) = SUMX ( SUMMARIZE ( 'Table', 'Table'[Invoice Date], 'Table'[Service/ Tax Date] ), DATEDIFF ( 'Table'[Service/ Tax Date], 'Table'[Invoice Date], DAY ) )
daXtreme
3 years agoSolution Sage
If in doubt... please consult DATEDIFF – DAX Guide