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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
ElenaCarciLopez
Helper II
Helper II

FILTRO AUTOMATICO EN UNA MATRIZ PARA QUE SOLO APAREZCAN DESDE EL MES ACTUAL AL FUTURO

Hola!

Tengo una matriz que muestra unos valores por meses, desde el mes actual hasta enero del 2026. 

ElenaCarciLopez_1-1718964753238.png

 

Actualmente el filtro tengo que ir quitando los meses a mano, cada vez que empezamos un nuevo mes: 

ElenaCarciLopez_0-1718964637823.png

Hay alguna manera que el filtro sea automático, es decir que detecte en que mes estamos y nos muestre los valores desde el mes actual hasta el último mes que tengo datos. 

He probado con Fecha Relativa pero me da la opción de este mes o desde el mes que viene y no los dos juntos.

Existe la posibilidad de automatizarlo? o debo seguir haciendolo a mano?

Muchas gracias por vuestra ayuda!

1 ACCEPTED SOLUTION
ElenaCarciLopez
Helper II
Helper II

He encontrado la solución de una forma bastante sencilla al final.

He creado en mi tabla calendario una columna que me indique si es mes actual o fututo "SI" y si es mes pasado "NO"

EsMesPasado-ActualOFuturo = IF(VALUE(
    [Month Year]) >= DATE(YEAR(TODAY()), MONTH(TODAY()), 1),
    "Si",
    "No"
)

y en el panel de Filtros he creado un filtro para el visual de matriz configurandolo para que me muestre los valores SI

 

View solution in original post

5 REPLIES 5
ElenaCarciLopez
Helper II
Helper II

He encontrado la solución de una forma bastante sencilla al final.

He creado en mi tabla calendario una columna que me indique si es mes actual o fututo "SI" y si es mes pasado "NO"

EsMesPasado-ActualOFuturo = IF(VALUE(
    [Month Year]) >= DATE(YEAR(TODAY()), MONTH(TODAY()), 1),
    "Si",
    "No"
)

y en el panel de Filtros he creado un filtro para el visual de matriz configurandolo para que me muestre los valores SI

 

MFelix
Super User
Super User

Hi @ElenaCarciLopez ,

 

You need to add a relative data has you refer. On your calendar table add a column that does the difference between YearMonth for today and YearMonth for the data you need

 

Power Query Syntax:

 Number.From  (Number.ToText (Date.Year([Date]) ) &

Text.PadStart( Number.ToText (Date.Month([Date]) ), 2,"0"))- Number.From(Number.ToText (Date.Year(DateTime.LocalNow()) ) &

Text.PadStart( Number.ToText (Date.Month(DateTime.LocalNow()) ), 2,"0"))

 

DAX Column:

MonthRelative =  (YEAR(Query1[Date]) & FORMAT(MONTH(Query1[Date]), "00")) - (YEAR(TODAY()) & FORMAT(MONTH(TODAY()), "00"))

 

Result will be similar to this

MFelix_1-1718976632622.png

 

Has you can see for current month is zero for next months is 1

 

Now use this column to filter the visual:

MFelix_2-1718976652725.png

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Many thanks for your answer. That's the result I am looking for.

I have an answer, how and where I should add this:

Power Query Syntax:

 Number.From  (Number.ToText (Date.Year([Date]) ) &

Text.PadStart( Number.ToText (Date.Month([Date]) ), 2,"0"))- Number.From(Number.ToText (Date.Year(DateTime.LocalNow()) ) &

Text.PadStart( Number.ToText (Date.Month(DateTime.LocalNow()) ), 2,"0"))

  Thanks!

Assuming you have tyour calendar table done in Power Query this code is for the creation of a new column on the calendar table.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



I don't succeed

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.