Forum Discussion
Ivancito111
Resolver I
4 years agoOccupy 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...
- 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.
Ivancito111
Resolver I
4 years agoI know that your answer solves my problem, but isn't there a method that doesn't ruin my board?
Greg_Deckler
Community Champion
4 years agoIvancito111 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.