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
Dangar332
Resident Rockstar
2 years agoHi, JavidRobatian
JavidRobatian
in above you create a column
my code work with measure so try to mae measure
download .pbix file click HERE
JavidRobatian
2 years agoFrequent Visitor
You are right
It was my fault
But again, I don't know why my results don't match yours
- Dangar3322 years ago
Resident Rockstar
HI, JavidRobatian
i think you use relationship bw tables so try to delete relationship- JavidRobatian2 years agoFrequent Visitor
Yes.
Amazing its work.
Thank you so much sir.