Forum Discussion

titanconsulting's avatar
titanconsulting
Frequent Visitor
3 years ago
Solved

Generate table multiple columns

I'm struggling to deal with data that is coming in from an external API.  I'd like to do some analysis on College Football - but the data for the games in coming in with a home and an away team.  The...
  • tackytechtom's avatar
    3 years ago

    Hi titanconsulting ,

     

    I think this is mostly a modelling quetion.

     

    How about creating two relationships from your teams table ("teams dimension") to your results table ("results fact"). Then you could possibly create a measure with the following logic:

     

    DIVIDE ( 

    CALCULATE ( COUNT ( home_team ), home_points > away_points, USERELATIONSHIP ( id, home_team ) ) +

    CALCULATE ( COUNT ( away_team  ), home_points < away_points, USERELATIONSHIP ( id, away_team ) ), 

    CALCULATE ( COUNT ( home_team ), USERELATIONSHIP ( id, home_team ) ) +

     CALCULATE ( COUNT ( away_team ), USERELATIONSHIP ( id, away_team ) ) )

     

    Note, the syntax might be wrong, but I hope this gives you an idea anyway.

     

    Let me know if this helps and if not feel free to share your pbix file and I can have a look into it.

     

    Thanks,

     

    /Tom
    https://www.tackytech.blog/
    https://www.instagram.com/tackytechtom/