cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Regular Visitor

## Check for value

 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!

1 ACCEPTED SOLUTION
Community Champion

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! 🙂

do not hesitate to give a kudo to useful posts and mark solutions as solution
8 REPLIES 8
Community Champion

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")

do not hesitate to give a kudo to useful posts and mark solutions as solution
Regular Visitor

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.

Community Champion

it is exactly what you asked for in the first post.

give me example of desired output, please, to complete solution 🙂

do not hesitate to give a kudo to useful posts and mark solutions as solution
Regular Visitor

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)

Community Champion

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! 🙂

do not hesitate to give a kudo to useful posts and mark solutions as solution
Community Champion
pay attention, I just correct statement in my last post

do not hesitate to give a kudo to useful posts and mark solutions as solution
Regular Visitor

well actually your changed version returns wrong values, the previous one was perfect

Community Champion

@Termigez ok, I fixed it 🙂

do not hesitate to give a kudo to useful posts and mark solutions as solution

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

#### Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

#### Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors