Forum Discussion
How to dynamically calculate the difference between two dates selected from a slicer?
- 9 years ago
Hi nikhil893,
PorkChop's DAX expression works fine.
Measure = DATEDIFF(MIN(Sales[Date]),MAX(Sales[Date]),DAY)&" Days"
Regards,
Charlie Liao
Hey dude.
If you are doing this in dax it's super simple.
=DATEDIFF([Startdate],[EndDate],second)
- nikhil8939 years agoNew Member
PorkChop : We need to have the start and end dates to be selected from the user using a slicer. Will this measure work for that too ? We do not have any columns named ' Start date' and 'end date'. We have only one column as date which we are using in a slicer.
- v-caliao-msft9 years agoMicrosoft Employee
Hi nikhil893,
PorkChop's DAX expression works fine.
Measure = DATEDIFF(MIN(Sales[Date]),MAX(Sales[Date]),DAY)&" Days"
Regards,
Charlie Liao
- PorkChop9 years agoAdvocate I
*flexes*
- PorkChop9 years agoAdvocate I
Interesting, maybe you could try
=DATEDIFF(min([DATE]),max([DATE]),second)
where [DATE] is the columnname of the slicer you are using?
- nikhil8939 years agoNew Member
PorkChop : The DATE coulmn may have dates from 1 Nov 2016 till 30 Nov 2016. The selection from the slicer could be 2 Nov (start date) and 4 Nov (End date). We need these two dates ( 2 Nov and 4 Nov) , not the min and max dates in the date column. Will this measure work for that ?