Forum Discussion
JavidRobatian
2 years agoFrequent Visitor
DATEDIFF with condition
Hi experts, hope you all doing good. I have two tables in Power BI called Date and Invoice that are related with (invoice[date] 1:* Date[Date]) Now I'm trying to Calculate DateDiff with below condi...
- 2 years ago
Hi, JavidRobatian
try belowMeasure = var a = SELECTEDVALUE('date'[month]) var b = DATEDIFF(CALCULATE(min(invoice[date]),ALLEXCEPT(invoice,invoice[cu nu])),TODAY(),DAY) var c = DATEDIFF(CALCULATE(min(invoice[date]),ALLEXCEPT(invoice,invoice[cu nu])),DATE(2023,a,1),DAY) var d = IF(ISFILTERED('date'[month]),c,b) return d
Fowmy
2 years agoSuper User
JavidRobatian
Try this measure: Make sure you add a Year slicer
Datediff =
IF(
ISFILTERED( 'Date'[Month] ) ,
INT( MAX( 'Date'[Date] ) - MAX( Invoice[Date] ) ),
INT(TODAY() - MAX( Invoice[Date] ) )
)
JavidRobatian
2 years agoFrequent Visitor
Thank you for your reply
I tried this but I think it doesn't work properly.
- Fowmy2 years agoSuper User
JavidRobatian
Share your PBI file using Google Drive and past the link here.- JavidRobatian2 years agoFrequent Visitor
Hi
Thank you for your reply
I share my PBI file
https://drive.google.com/file/d/1MJ1vWk2BShxE87eH7BM7QYkBX03p8zY3/view?usp=drive_link