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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rohitbinnani
Advocate III
Advocate III

DAX query for Games Winning %

In power BI i want to filter by Team A's Bangalore and want Winning % of Bangalore as Team A. i.e. if i Filter with Bangalore from Team A i want (Winner/Team A)*100 which shows me the winning % of Bangalore also it should match the exact figure if i filter it with Year. This Data set is just an Example of of my Question, my actual data set is sensitive and very huge so can't post it here. Also Team A column belongs from a different table and Winner Belongs from a different table. So how can i create a Dax Query for this ?

Match Against MizoramMatch Against Mizoram

 

Thanks and Regards,

Rohit Binnani

 

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @rohitbinnani,

 

Since column [Team A] belongs from a different table and [Winner] comes from another table, you should first combine them into a single table based on specific relationship. 

 

As I don't know what relationship is between the original two tables, suppose the combination table looks like above you posted. And there are two slicers in your report, one is for [Team A], another is for [Year]. In that case, please create measures like:

CountSelectedWinner =
CALCULATE (
    COUNTA ( 'Game Winning'[Winner] ),
    FILTER (
        'Game Winning',
        'Game Winning'[Winner] = LASTNONBLANK ( 'Game Winning'[Team A], 1 )
    )
)

CountTeamA =
CALCULATE (
COUNTA ( 'Game Winning'[Team A] ),
FILTER (
'Game Winning',
'Game Winning'[Team A] = LASTNONBLANK ( 'Game Winning'[Team A], 1 )
)
)

Winning% = [CountSelectedWinner]/[CountTeamA]

1.png

 

If I have something misunderstood, please provide more description about your requirement.

 

Thanks,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yulgu-msft,

 

i tried it with different table. what if my filter of Team A is in and connected in this table as per a primary key. we have team A in this table itself but i have another dimension from which i am bringing my Team A as filter just because that is also connected to some more tables to filter them too. can you help me in this ?

the script you provided works perfect if they belong from same table. !!!

 

Regards,

Rohit Binnani.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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