Forum Discussion
Return Max date based on multiple condition
- 2 years ago
hello MiloDi
output
measure 1 -- start date
Start Date = var start_date = FILTER( Tableau1, Tableau1[Name] = "AB" ) return MINX(start_date,Tableau1[Date])measure 2 -- end date
End Date = var count_all = COUNTROWS(Tableau1) var end_true = FILTER( Tableau1, Tableau1[Status] = TRUE() ) var count_true = COUNTROWS(end_true) var res = SWITCH( TRUE(), count_all <> count_true , blank(), MAXX(end_true,[Date]) ) return reslet me know if this works for you .
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠 - 2 years ago
modify the code to this :
End Date = var count_all = calculate(COUNTROWS(Tableau1) , REMOVEFILTERS(Tableau1[Status])) var end_true = FILTER( Tableau1, Tableau1[Status] = TRUE() ) var count_true = COUNTROWS(end_true) var res = SWITCH( TRUE(), count_all <> count_true , blank(), MAXX(end_true,[Date]) ) return reslet me know if this helps ....
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠
hello MiloDi
output
measure 1 -- start date
Start Date =
var start_date =
FILTER(
Tableau1,
Tableau1[Name] = "AB"
)
return
MINX(start_date,Tableau1[Date])
measure 2 -- end date
End Date =
var count_all = COUNTROWS(Tableau1)
var end_true =
FILTER(
Tableau1,
Tableau1[Status] = TRUE()
)
var count_true = COUNTROWS(end_true)
var res =
SWITCH(
TRUE(),
count_all <> count_true , blank(),
MAXX(end_true,[Date])
)
return res
let me know if this works for you .
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠
- MiloDi2 years agoFrequent Visitor
Good afternoon, Daniel29195,
First thank you for your time and your answer.
In my case its not working properly , I have date for Id who have one false statut.
I join you the PBI, perhaps I do soemthing wrong.
Can you guide me ?
thank you in advance
- Daniel291952 years agoCommunity Champion
modify the code to this :
End Date = var count_all = calculate(COUNTROWS(Tableau1) , REMOVEFILTERS(Tableau1[Status])) var end_true = FILTER( Tableau1, Tableau1[Status] = TRUE() ) var count_true = COUNTROWS(end_true) var res = SWITCH( TRUE(), count_all <> count_true , blank(), MAXX(end_true,[Date]) ) return reslet me know if this helps ....
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠- MiloDi2 years agoFrequent Visitor
Hello Daniel29195
Thank you very much for your time. Its working fine sir. It's amazing.
I understand your measure So I'm getting better at it too 😉