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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Narukkp
Helper V
Helper V

El filtro del mes anterior de M-Query no funciona como SQL Database durante los 2 meses anteriores

Hola equipo,
Tengo los últimos 2 meses de datos basados en el día actual, pero M-Query filtro del mes anterior no está funcionando como SQL Database para los 2 meses anteriores y está dando los datos de Aug1st2020 en lugar de Aug15th2020.

¿Podría por favor hacerme saber cómo restringir los últimos 2 meses exactos datos (Desde Aug15th2020) basado en el día actual.

1 ACCEPTED SOLUTION
edhans
Super User
Super User

Use Date.AddMonths. Vea a continuación:

edhans_0-1602776058958.png

Date.AddMonths([Date], -2)

Eso moverá la fecha exactamente 2 meses atrás donde sea posible. Observe cómo me mudé Oct 31 1 mes atrás. No hay 31 de septiembre, así que lo trasladó al 30 de septiembre en ese caso.

Para usarlo como filtro usando la fecha de hoy, puede usar esto:

= Table.SelectRows(#"Added Custom1", each [Two Months back] >= Date.AddMonths(DateTime.Date(DateTime.LocalNow()), -2))

Eso lo hará todo el 15 de agosto de 2020 y posteriores.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

4 REPLIES 4
edhans
Super User
Super User

Use Date.AddMonths. Vea a continuación:

edhans_0-1602776058958.png

Date.AddMonths([Date], -2)

Eso moverá la fecha exactamente 2 meses atrás donde sea posible. Observe cómo me mudé Oct 31 1 mes atrás. No hay 31 de septiembre, así que lo trasladó al 30 de septiembre en ese caso.

Para usarlo como filtro usando la fecha de hoy, puede usar esto:

= Table.SelectRows(#"Added Custom1", each [Two Months back] >= Date.AddMonths(DateTime.Date(DateTime.LocalNow()), -2))

Eso lo hará todo el 15 de agosto de 2020 y posteriores.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Thank you so much it is working ...

Hola, @Narukkp

¿Podría decirme si su problema ha sido resuelto?
Si es así, marque las respuestas útiles o agregue su respuesta como Respondida para cerrar este hilo.
Si no lo ha hecho, por favor comparta más detalles.

Saludos
Equipo de soporte de la comunidad _ Eason

Thanks for your reply , but  i required the two months back data based on table column i.e i have a table called sales trans and it is having the Invoice Date , so i reuqired the last 2 months invoice dates.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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