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
Sunila
Helper I
Helper I

Amount breakdown in 13 week bucket

Hi, 

 

I've encountered a challenge while working on weekly bucket. I intend to display a distribution of weekly amounts for the upcoming 13 weeks. I attempted to link Table A's "WeekStartDate" with Table B's "date" column to retrieve the amount. However, this join appears to be ineffective, as amounts aren't appearing for all weeks as expected.

In an effort to address this, I tried merging the two tables using Power Query. Unfortunately, using a Left join did not yield any matching records due to the weekly date folding. My objective is to ensure that all dates are displayed in correspondence with the respective weeks, where the WeekEndDate signifies the week's conclusion.

Could anyone offer any guidance or suggestions ?

 

Sunila_0-1691144053585.png

 

1 ACCEPTED SOLUTION

Xinru Zhu 

Best Regards!

Yolo Zhu

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

4 REPLIES 4
Sunila
Helper I
Helper I

Hi, @v-xinruzhu-msft 

Unfortunately, I dont have the appropriate role to attach the pbi.

Here is screen shot of Table A and advance editor code

let
Source = {Int32.From(DateTime.LocalNow())-1..Int32.From(DateTime.LocalNow())+6*14+1},
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Date.AddDays([Column1],6)),
#"Filtered Rows" = Table.SelectRows(#"Added Custom", each Date.DayOfWeek([Column1])=Date.DayOfWeek(DateTime.LocalNow())),
#"Added Custom1" = Table.AddColumn(#"Filtered Rows", "Custom.1", each Date.ToText([Column1],[Format="dd/M"]) & "-" & Date.ToText([Custom],[Format="dd/M"])),
#"Renamed Columns" = Table.RenameColumns(#"Added Custom1",{{"Column1", "WeekStartDate"}, {"Custom", "WeekEndDate"}, {"Custom.1", "Week"}}),
#"Changed Type1" = Table.TransformColumnTypes(#"Renamed Columns",{{"WeekStartDate", type date}, {"WeekEndDate", type date}})
in
#"Changed Type1"

Sunila_0-1691430973864.png

Table B

Sunila_1-1691431017402.png

Table A.WeekStartDate join Table B.Date (One to many)

Report View : Amount distribution is not appearing for some week buckets, Amount in 13 weeks bucket must add up to Totals in Right. 

Sunila_2-1691431062112.png

Please note, report is designed to dynamically start from the current date. So, each week will kick off with today's date. Should have any questions please let me know. 

 

 

Xinru Zhu 

Best Regards!

Yolo Zhu

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

 

Thank you so much, your proposed solution did work.

v-xinruzhu-msft
Community Support
Community Support

Hi @Sunila 

Can you provide some more sample data or pbix file, I cannot get the information based on the picture you have provided.

 

Best Regards!

Yolo Zhu

 

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.