Forum Discussion

mayenscb's avatar
mayenscb
Regular Visitor
5 years ago
Solved

NFL Win %

I am trying to get a card to show the win % of teams that I have listed on a bar chart. The formula in excel would be =# of wins/(# of wins + # of losses). Is there a way I can do this in Power BI an...
  • v-kelly-msft's avatar
    v-kelly-msft
    5 years ago

    Hi  mayenscb ,

     

    Create a measure as below:

    Home win% = 
    var _winscore=CALCULATE(SUM('Table'[Score_home]),FILTER(ALL('Table'),'Table'[team_home]=MAX('Table'[team_home])&&'Table'[Home team outcome]="Win"))
    var _losescore=CALCULATE(SUM('Table'[Score_home]),FILTER(ALL('Table'),'Table'[team_home]=MAX('Table'[team_home])&&'Table'[Home team outcome]="Loss"))
    Return
    DIVIDE(_winscore,_winscore+_losescore)+0

    And you will see:

     

     

    For the related .pbix file,pls see attached.

     

    Best Regards,
    Kelly

    Did I answer your question? Mark my post as a solution!