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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
jayceeb
Frequent Visitor

WEEKLY TRENDS comparison

Hi, I have daily data entry I just want to get the weekly trends comparison example my data is 

DateQuantity
1-Jan1
2-Jan1
3-Jan1
4-Jan1
5-Jan1
6-Jan1
7-Jan1
8-Jan1
9-Jan1
10-Jan1
11-Jan1
12-Jan1
13-Jan1
14-Jan1
1-Feb2
2-Feb2
3-Feb2
4-Feb2
5-Feb2
6-Feb2
7-Feb2
8-Feb2
9-Feb2
10-Feb2
11-Feb2
12-Feb2
13-Feb2
14-Feb2

  I want my result to show like this if i select the date filter . is it possible to put it in graph as well? please help. Thank you:)

MonthWeekTotal
Jan 1-Jan 7week 17
Feb 1- Feb 7week 114
Jan 8-Jan 14week 27
Feb 8- Feb 14week 214
4 REPLIES 4
v-yilong-msft
Community Support
Community Support

I create a table as you mentioned.

vyilongmsft_3-1738637428976.png

Then I create two calculated columns and here are the DAX codes.

WeekRange =
VAR StartOfWeek =
    'Table'[Date] - WEEKDAY ( 'Table'[Date], 2 ) + 1
VAR EndOfWeek = StartOfWeek + 6
RETURN
    FORMAT ( StartOfWeek, "MMM d" ) & " - "
        & FORMAT ( EndOfWeek, "MMM d" )
 
WeekNumber =
"week "
    & WEEKNUM ( 'Table'[Date], 2 ) - WEEKNUM ( STARTOFMONTH ( 'Table'[Date] ), 2 ) + 1
vyilongmsft_4-1738637500138.png

Next I think you can create a new table.

WeeklyTrends =
SUMMARIZE(
    'Table',
    'Table'[WeekRange],
    'Table'[WeekNumber],
    "Total", SUM('Table'[Quantity])
)
vyilongmsft_5-1738637650399.png

 

 

Best Regards

Yilong Zhou

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

hi i got it however the date is not arrange.

jayceeb_1-1738736286507.png

 

i use the sorting but still mixed. and in the table wek1 and week 6 is the same date. i also use filter for the dates.  how to arrange the date please.

jayceeb_3-1738736519921.png

 

 

 

 

Hi @jayceeb ,

In Power BI Desktop, if you want to use a DAX statement after selecting a date, you need to strictly follow the Week rule on the calendar to do so. 

WeeklyTotal = 
CALCULATE(
    [TotalQuantity],
    ALLEXCEPT('Table', 'Table'[MonthYear], 'Table'[WeekNumber])
)

vyilongmsft_0-1738742581997.png

 

 

Best Regards

Yilong Zhou

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

amitchandak
Super User
Super User

@jayceeb , You have create week columns in you table

 

Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],1)+1 //Sunday

 

Week Start date Monday = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1 //Monday

 

Week End date = [Week Start date] +6

format and use in other column

 

You can check here

https://www.youtube.com/watch?v=cyWVzAQF9YU&t=40648s


Any Weekday Week - Start From Any day of Week
https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Powe...
https://medium.com/chandakamit/cheat-sheet-any-weekdays-week-start-date-just-one-variable-apart-6b2e...

 

Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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