Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
date | home | away |
17.10.2018 | a | f |
18.10.2018 | a | b |
19.10.2018 | f | c |
I want to create a new calculate column to check whether a value in 'home' column is present in either 'home' column or 'away' column only for rows with yesterday's date. So for example for a game on 19.10.2018 the formula would return blank because 'f' didn't play yesterday - his last game was 2 days ago. But for a game on 18.10.2018 the formula would return something ("yes", "1") etc. because 'a' indeed played a game on 17.10.2018. Thank you!
Solved! Go to Solution.
sorry, it was my bad
Column =
var _playedYesterday = countrows(filter('Table','Table'[date]=EARLIER('Table'[date])-1 && ('Table'[home]=EARLIER('Table'[away]) || 'Table'[home]=EARLIER('Table'[home]))))
return
if(_playedYesterday>0,"yes","no")
should be correct for back-to-back games for home team
I love sports stats! 🙂
hi @Termigez
try a column
Column =
var _playedYesterday = countrows(filter('Table','Table'[date]=EARLIER('Table'[date])-1 && ('Table'[away]=EARLIER('Table'[away]) || 'Table'[home]=EARLIER('Table'[home]))))
return
if(_playedYesterday>0,"yes","no")
Hi, it is super close! However right now this formula doesn't tell me whether home team or away team played yesterday. It returns "yes" if one of those teams played yesterday but doesn't specify which one. I would like to verify this condition just for a home team, whether it played yesterday as a home team or away team.
Sorry, I am not a native speaker so maybe I didn't specify my desired outcome well enough.
date | home | away | b2b |
17.10 | A | B | no |
17.10 | C | D | no |
18.10 | E | D | no |
18.10 | A | F | yes |
18.10 | B | X | yes |
19.10 | C | D | no |
19.10 | F | G | yes |
longer example. We don't have rows with date before 17.10 so the formula returns no. Then for 18.10 - for the first row it returns 'no' because E didn't play yesterday. D played yesterday but I am not interested in it (right now your formula returns 'yes' for this row). Second row for 18.10 returns 'yes' because home team A played yesterday as a home team. Third row for 18.10 returns 'yes' because home team B played yesteday as an away team. First row for 19.10 returns 'no' because C didn't play yesterday and I don'y care about an away team D. Second row for 19.10 returns 'yes' because once again home team played yesterday as an away team.
So in a nutshell: I only care for a home team whether it played yesterday in any game (no matter it was home or away game)
sorry, it was my bad
Column =
var _playedYesterday = countrows(filter('Table','Table'[date]=EARLIER('Table'[date])-1 && ('Table'[home]=EARLIER('Table'[away]) || 'Table'[home]=EARLIER('Table'[home]))))
return
if(_playedYesterday>0,"yes","no")
should be correct for back-to-back games for home team
I love sports stats! 🙂
well actually your changed version returns wrong values, the previous one was perfect
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
111 | |
96 | |
89 | |
38 | |
28 |