Forum Discussion
Date calculation - empty fields
- 6 years ago
Hi srdjanmish ,
The reason for the blank value is that your dateslicer also filters the original table. Please refer to the measure below:
MeasureDifference = VAR MaxSelectedDate = CALCULATE ( MAX ( 'Calendar'[Date] ), ALLSELECTED ( 'Calendar' ) ) RETURN CALCULATE ( DATEDIFF ( MAX ( 'Datatable1'[DueDate] ), MaxSelectedDate, DAY ), CROSSFILTER ( 'Datatable1'[Document date], 'Calendar'[Date], NONE ) )If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
srdjanmish , Try like
MeasureDifference =
Var _max =MAXX(ALLSELECTED('Calendar'),'Calendar'[Date]))
return
DATEDIFF(MAX('Datatable1'[DueDate]),_max,DAY)
You need to force a row context too for grand total refer
- srdjanmish6 years agoHelper I
This is not good... I need result for each row in DataTable1, difference between Max selected date and DueDate. With this calculation, I get Max(DueDate) and Max selected date difference...
Grand total does not matter, it is not needed...
- srdjanmish6 years agoHelper I
Sorry, I tried as a column (without MAX on columnd DueDate), and as a measure (with MAX)...
As a measure, it shows good value, but still, on number of rows i get blank value, and DueDate exists...
Image:
- v-deddai1-msft6 years agoCommunity Support
Hi srdjanmish ,
The reason for the blank value is that your dateslicer also filters the original table. Please refer to the measure below:
MeasureDifference = VAR MaxSelectedDate = CALCULATE ( MAX ( 'Calendar'[Date] ), ALLSELECTED ( 'Calendar' ) ) RETURN CALCULATE ( DATEDIFF ( MAX ( 'Datatable1'[DueDate] ), MaxSelectedDate, DAY ), CROSSFILTER ( 'Datatable1'[Document date], 'Calendar'[Date], NONE ) )If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai