Forum Discussion
gauravnarchal
6 years agoPost Prodigy
Date Difference
I need help with the measure to calculate the date difference between two dates in a table. Once I have the days calculated, I then need to get the results as how many items were shipped between ...
- Anonymous6 years ago
Hi gauravnarchal ,
Check the following measures.
Measure = var datediff = DATEDIFF(SELECTEDVALUE('Table'[booking date]),SELECTEDVALUE('Table'[shipped date]),DAY) return SWITCH(TRUE(),datediff>=1&&datediff<=7,"1-7",datediff>=8&&datediff<=10,"8-10",datediff>=11&&datediff<=13,"11-13",datediff>=13,"13&more") Measure 2 = CALCULATE(DISTINCTCOUNT('Table'[id]),FILTER('Table',[Measure]=SELECTEDVALUE(days[days])))Result would be shown as below.
Best Regards,
Jay
Anonymous
6 years agoNot applicable
you can create a column
_datediff =
var _diff = DATEDIFF(Table[Booking Date], Table[Shipped Date], DAY)
Return IF([_diff]<=7,"1-7",IF([_diff]<=10,"8-10",IF([_diff]<=13,"11-13","13 and More")))
and create a matrix chart with _datediff and count of _datediff column.
Let em know if you need help projecting it in table.
- gauravnarchal6 years agoPost Prodigy
Anonymous - Instead of creating column can this be achieved with the measure?
- Anonymous6 years agoNot applicable
Yes, you can use measure to create it.
- gauravnarchal6 years agoPost Prodigy
Anonymous - I am not getting the table when creating the measure. Is there something wrong I am doing?
See below screenshot.