2 Replies Latest reply: Nov 30, 2017 4:09 AM by Ross Denton RSS

    Using a dimension as a variable

    Ross Denton

      Hi everyone,

       

      I have seen lots of examples of using variables as a dimension, but I want to use the dimension of my chart as a variable!

       

      I am creating a football team visualisation and I currently have two tables - one with match results (containing HomeTeam, AwayTeam) and another with all possible teams (Team). I am trying to use Team as a dimension but this means that I cannot simply add up either Home Goals or Away Goals to work out how many goals they have scored, as this would add up all the goals scored in any match they have played and not just the goals they have scored!

       

      I have worked around this when I have selected a particular team by using the set analysis:

           SUM({<HomeTeam = {"$(=GetFieldSelection(Team))"}>} FTHG)

      and this works great! (FTHG = Full Time Home Goals).

       

      However, when I try to use this in the chart there is no current Team selected, so this doesn't work, nor does simply HomeTeam = Team. Can anyone please help me on this?!

       

      Ross

        • Re: Using a dimension as a variable
          Stefan Wühl

          How does your input table or data model look like?

           

          Here is a similar request, probably built up on a different table structure, but maybe you can adapt to your needs:

          Sum goals a team has suffered

            • Re: Using a dimension as a variable
              Ross Denton

              Hi Stefan,

               

              Unfortunately it's not the same problem. My problem is that I need to use the dimension of the chart as a variable in my chart expression.

               

              FYI, one of my tables has:

              Date, HomeTeam, AwayTeam, Result, Full Time Home Goals, Full Time Away Goals, Home Shots, Away Shots etc...

               

              The other table has:
              Team, BackgroundRGB, TextRGB, OutlineRGB, PictureLink etc.

               

              The team is in the same format as HomeTeam and AwayTeam - so when team is selected, I have used it as a variable [ "GetFieldSelections($(=Team))" ] to select when Team = HomeTeam, however when Team is used as a dimension in a chart it seems as if it's not actually selecting a Team so this can't be used.