Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
loanacabanillas
Regular Visitor

"Año fiscal" movil - comienza según el filtro y muestro ultimos 5 años

Buenas tardes, estoy con un problema para generar una medida en Power BI. Desde ya muchas gracias por cualquier ayuda o sugerencia que tengan. 

Tengo configurada una columna calculada que obtiene el mes actual y los 12 meses siguentes según el filtro seleccionado:

Añofiscal =
 VAR Anio = YEAR(Indice[Periodo])
 VAR MES = MONTH(Indice[Periodo])
 VAR MESINICIAL = MONTH(SELECTEDVALUE(Indice[Periodo]))
 RETURN
    CONCATENATE(FORMAT(Indice[Periodo], "MMM"), Anio & FORMAT(DATEADD(Indice[Periodo],1,MONTH), "MMM")& Anio+1)
 
Esto hace que según el mes que seleccione en el filtro me devuelva lo siguiente: 
loanacabanillas_0-1721155546603.png

 

Si selecciono otro mes 

image.png

 Este es el resultado. 

Esto es correcto es lo que espero, pero además de esto necesito que me grafique del periodo seleccionado los ultimos 5 años. 

es decir: 

image.png

El acumulado desde agos2021 a sep2022, agos2022 a sep2023, etc, pero aun no eh logrado obtener este resultado por más que intente reiteradas veces. 

Quizas el problema este en como calcule el "Año fiscal" pero si o si lo necesito en columna debido a que Power BI no permite poner una medida en un eje X de un grafico. 

 

¿Alguna idea de como resolver esto?

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @loanacabanillas 

 

I'm afraid your requirement cannot be achieved directly. If you want to display the data of the previous five years of the selected date in the visualization, please refer to the following test.

 

My sample data is from 2022 to the present, and the formula I wrote calculates the data for the past year of the selected date.

vxuxinyimsft_0-1721290264589.png

 

Measure:

 

 

MEASURE =
IF (
    DATE ( YEAR ( MAX ( [Date] ) ), MONTH ( MAX ( [Date] ) ), DAY ( MAX ( [Date] ) ) )
        >= DATE ( YEAR ( SELECTEDVALUE ( slicer[Date] ) ) - 1, MONTH ( SELECTEDVALUE ( slicer[Date] ) ), DAY ( SELECTEDVALUE ( slicer[Date] ) ) ),
    1,
    0
)

 

 

 

Put the measure into the visual-level filters, set up show items when the value is 1.

vxuxinyimsft_1-1721290368464.png

 

Output:

vxuxinyimsft_0-1721291008891.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @loanacabanillas 

 

I'm afraid your requirement cannot be achieved directly. If you want to display the data of the previous five years of the selected date in the visualization, please refer to the following test.

 

My sample data is from 2022 to the present, and the formula I wrote calculates the data for the past year of the selected date.

vxuxinyimsft_0-1721290264589.png

 

Measure:

 

 

MEASURE =
IF (
    DATE ( YEAR ( MAX ( [Date] ) ), MONTH ( MAX ( [Date] ) ), DAY ( MAX ( [Date] ) ) )
        >= DATE ( YEAR ( SELECTEDVALUE ( slicer[Date] ) ) - 1, MONTH ( SELECTEDVALUE ( slicer[Date] ) ), DAY ( SELECTEDVALUE ( slicer[Date] ) ) ),
    1,
    0
)

 

 

 

Put the measure into the visual-level filters, set up show items when the value is 1.

vxuxinyimsft_1-1721290368464.png

 

Output:

vxuxinyimsft_0-1721291008891.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.