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
lauraespinade
Regular Visitor

UPDATE POWER QUERY TABLE WITH DATA FROM PREVIOUS AND ACTUAL MONTH

Hi,

 I want to update in power query table only data form the last 4 weeks to minimize the time updating.

I have used this formula, but it only updates the data from the actual month.:

= Table.SelectRows(BME_LOSS_TREE_Table, each Date.IsInCurrentMonth([DATATIME_UTC]))

I try with this other formula, but it updates the data from the previous month, no data from this month :

= Table.SelectRows(BME_LOSS_TREE_Table, each Date.IsInPreviousNMonths([DATATIME_UTC];1))

I try to combine it by using && and || , but without result.

Thanks,

Laura

 

 

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

You need to use Date.IsInPreviousNWeeks for last 4 weeks. Hence, use below

 

= Table.SelectRows(BME_LOSS_TREE_Table, each Date.IsInPreviousNWeeks([DATATIME_UTC],4))

 

if you need dates of current week also to be considered

= Table.SelectRows(BME_LOSS_TREE_Table, each Date.IsInPreviousNWeeks([DATATIME_UTC],4) or Date.IsInCurrentWeek([DATATIME_UTC]))

View solution in original post

2 REPLIES 2
lauraespinade
Regular Visitor

Thank you!! What I need was your second option

Vijay_A_Verma
Super User
Super User

You need to use Date.IsInPreviousNWeeks for last 4 weeks. Hence, use below

 

= Table.SelectRows(BME_LOSS_TREE_Table, each Date.IsInPreviousNWeeks([DATATIME_UTC],4))

 

if you need dates of current week also to be considered

= Table.SelectRows(BME_LOSS_TREE_Table, each Date.IsInPreviousNWeeks([DATATIME_UTC],4) or Date.IsInCurrentWeek([DATATIME_UTC]))

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.

Top Solution Authors
Top Kudoed Authors