Forum Discussion

quickbi's avatar
quickbi
Icon for Helper II rankHelper II
2 years ago
Solved

Last 12 month chart

Hi All,

I want to create a last 12 months revenues chart depending on the date selected in a Year-month selector.

I create a StartDate measure:

 

StartDate = 
VAR SelectedDate = [SelectedDate]-1
VAR StartDate = EDATE([SelectedDate], -11) -- Calcular la fecha de inicio (hace 11 meses desde la fecha seleccionada)
RETURN
    StartDate

 

Another to Calculate Only Revenues:

 

PL_Revenues_Amount = 
CALCULATE(
    sum('PL Ledger'[total_balance]),
    'Income statement'[level1 order] in {10}
    
)

 

and finaly the total Amount for last 12M:

 

TotalRevenueLast12Months = 
VAR SelectedDate = [SelectedDate] -- Suponiendo que tienes una medida que selecciona la fecha actual
VAR StartDate = EDATE(SelectedDate, -11) -- Calcular la fecha de inicio (hace 11 meses desde la fecha seleccionada)
RETURN
    CALCULATE(
        [PL_Revenues_Amount], -- Sumar la columna de ingresos
        DATESBETWEEN(
            'Calendar'[Date],
            StartDate,
            EOMONTH(SelectedDate, 0)
        )
        --'Income statement'[Level1] IN {"Net Revenue"} -- Filtra solo las cuentas 70000 y 70001
    )

 

It works in a table value mode, but I want to show a bar chart with last 12 Months, but unfortunate only shows the months I selected

How to do that?

Thanks in advance everyone