Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
maxduff59
Helper II
Helper II

Filter Sports Games Table by HomeTeam or AwayTeam

Hello,

I am trying to build a Power BI for sports game data. I have some tables such as these two :

  • MATCHS : containing hometeam, awayteam, the points of each team
  • STATS : containing the stats of each team

Capture d’écran 2023-07-14 à 14.09.04.png

They are both related by an fx_code. I created a filter on my dashboard based on the column Team of STATS.
With the value chosen in the filter, I want to keep all these games of MATCHS table (no matter if it is hometeam or awayteam).

So I tried to create a new table like that : 
new_table = 

var team = SELECTEDVALUE(team)

RETURN FILTER(matchs,OR(matchs[hometeam] = team,matchs[awayteam] = team))

but it returns an empty table and I do not know why ? 

 

Capture d’écran 2023-07-14 à 14.19.55.png

 

Thanks in advance for your help and your time

1 REPLY 1
AbhinavJoshi
Responsive Resident
Responsive Resident

You can create a relationship between the two tables in Relation View, or merge them through Power Query M using fx_code. Is there a specific visual you are trying to create where the filters are not working. Also, in the model view make sure you set the cross filter direction appropriately. Hope it helps! 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.