Forum Discussion

Ivancito111's avatar
Ivancito111
Icon for Resolver I rankResolver I
4 years ago
Solved

Occupy a variable with a table name

Hello, good afternoon, I am writing to you because I have a question about a table filter. What happens is that I have a value that changes by month and day, ie, today we are in September 20, I need...
  • Greg_Deckler's avatar
    Greg_Deckler
    4 years ago

    Ivancito111 The only thing you are left with is a big long SWITCH statement like:

     

     

    Measure = 
      VAR __dia = DAY(TODAY())
      VAR __month = MONTH(TODAY())
    RETURN
      SWITCH(__month),
        1, CALCULATE(SUMX('Tabla1', 'Tabla1'[Enero]), FILTER('Tabla1','Tabla1'[Dia]=__dia)),
        2, CALCULATE(SUMX('Tabla1', 'Tabla1'[Febrero]), FILTER('Tabla1','Tabla1'[Dia]=__dia)),
        3, CALCULATE(SUMX('Tabla1', 'Tabla1'[Marzo]), FILTER('Tabla1','Tabla1'[Dia]=__dia)),
        ...
      )
        

     

    Also, the unpivoting would be in Power Query Editor, not in the source data.