Forum Discussion
Auto select previous months
- 9 years ago
Anonymous
Try this:
Create a table with Months (1....12) Use this as Slicer. Don't related with your data table.
Create a Measure:
ValuesChart = VAR MAXMONTH = VALUES ( Months[Month] ) RETURN IF ( VALUES ( Table1[Month] ) <= MAXMONTH, CALCULATE ( SUM ( Table1[Values] ) ), BLANK () )Use this measure in your chart.
Vvelarde thank you,
It is possible replicate your code in a card label, to show me a % ?
I'm using your code unsuccessful in my card label:
Var =
VAR MAXMONTH =
VALUES ( 'Calendar'[MonthNumber] )
RETURN
IF (
VALUES ( 'Calendar'[MonthNumber]) <= MAXMONTH;
CALCULATE ( DIVIDE('OINV E ORIN'[Variação Current vs Previous Year tons Activos];'OINV E ORIN'[Consumo de clientes Tons Previous Year];0) );
BLANK ()
)
Anonymous
The measure fail becasuse There is not a unique Calendar's Month selected, in the chart this work because your Axis is the each month so Values is a unique row.
What is the % that you want to show
- Anonymous9 years agoNot applicable
my goal is to show in my card label the previous year variance in %. You're right, with this calendar I'm unable to show any result. There is other way using your code or the same logic?
my main code that I want the % is:
Variação Current vs Previous Year em % perda de Volume = DIVIDE('OINV E ORIN'[Variação Current vs Previous Year tons Activos];'OINV E ORIN'[Consumo de clientes Tons Previous Year])"subcodes"...:
Variação Current vs Previous Year tons Activos:
Variação Current vs Previous Year tons Activos = 'OINV E ORIN'[Consumo de clientes Activos Current Year em Tons]-'OINV E ORIN'[Consumo de clientes Activos Previous Year em Tons]
Consumo de clientes Tons Previous Year:
Consumo de clientes Tons Previous Year = CALCULATE(SUM('OINV E ORIN'[Quantidade Tons]);FILTER('OINV E ORIN';'OINV E ORIN'[Estado Ano]="Previous"))Consumo de clientes Activos Previous Year em Tons:
Consumo de clientes Activos Previous Year em Tons = CALCULATE(SUM('OINV E ORIN'[Quantidade Tons]);FILTER('OINV E ORIN';'OINV E ORIN'[Inactivo]<>"Y");FILTER('OINV E ORIN';'OINV E ORIN'[Estado Ano]="Previous"))