Forum Discussion
Anonymous
3 years agoNot applicable
DIFFERENCE BETWEEN MULTIPLE DATES
Hi I have a table with different sales dates X product , i want to put them on a visualisation matrice to have the difference between each sales date filtered by product name as showed below I'm...
grazitti_sapna
Super User
3 years agoHey, you can try using
DIFFERENCE =
VAR CurrentProduct = SELECTEDVALUE('Product'[Product Name])
VAR CurrentDate = SELECTEDVALUE('Sales'[Sell Date])
RETURN
CALCULATE(
MIN('Sales'[Sell Date]) - CurrentDate,
FILTER(
ALL('Sales'),
'Sales'[Product Name] = CurrentProduct &&
'Sales'[Sell Date] < CurrentDate
)
)
Thank you. Hope this will help
Anonymous
3 years agoNot applicable
Hi Thanks but this is giving me a date as result and not a number
- grazitti_sapna3 years ago
Super User
Hey,You can try usingDIFFERENCE =VAR CurrentProduct = SELECTEDVALUE('Product'[Product Name])VAR CurrentDate = SELECTEDVALUE('Sales'[Sell Date])RETURNDATEDIFF(MINX(FILTER('Sales','Sales'[Product Name] = CurrentProduct &&'Sales'[Sell Date] < CurrentDate),'Sales'[Sell Date]),CurrentDate,DAY)Thnak you
Hope this will help.