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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
gojohnson
Frequent Visitor

Add rows based on conditions met

I am working to transform data from monthly totals to weekly totals. I can use a simple division to break the monthly forecast into weekly totals. Each line of the data shown also has a product and plant codes in addition to the date and sum(forecast). However, the date and forecast columns are the ones that need broken down. So each 1/1/2022 date needs to be broken down to 1/3/2022, 1/10/2022, 1/17/2022, 1/24/2022, and 1/31/2022. The totals for each date would be the same for each date. How do I add rows for the adjusted dates with the new forecast totals?

gojohnson_0-1709741261613.png

 

1 ACCEPTED SOLUTION
slorin
Super User
Super User

Hi,

add column

List.Select(List.Dates([Date],Date.Day(Date.EndOfMonth([Date])),#duration(1,0,0,0)), each Date.DayOfWeek(_)=0)

 and expand this new column to rows

 

Stéphane

View solution in original post

1 REPLY 1
slorin
Super User
Super User

Hi,

add column

List.Select(List.Dates([Date],Date.Day(Date.EndOfMonth([Date])),#duration(1,0,0,0)), each Date.DayOfWeek(_)=0)

 and expand this new column to rows

 

Stéphane

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors