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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
dwelsh
Advocate I
Advocate I

First Week of Month to Include Days from Previous Month

I am trying to create a Matrix that has columns for each date of the first week of the month and list sales by department. I want this to include any day of the first week that occurred in the previous month. For instance, for the month of May, the the matrix should have a column for each day between Monday 4/29 thru Sunday 5/5 (we start our week on Monday). The page has a Fiscal Year and Month slicer for users to interact with.

 

In the below on the first Matrix, I am not able to get 4/29 and 4/30 columns to display.

 

dwelsh_1-1715869015279.png

 

I am able to group them by week and return the correct total (second matrix) by using the below measure for the Sales data:

 
Weekly Sales = 
CALCULATE(
    [Gross Sales]
    ,DATESBETWEEN('Date'[Date],min('Date'[WeekStart]),max('Date'[WeekEnd]))
    ,All('Date'[Fiscalyear],'Date'[MonthName])
    )


I cannot however figure out how to make the two April date columns appear on the top matrix. Any suggestion on how to acheive this?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @dwelsh 

You can refer to the following sample data.

Sample data 

vxinruzhumsft_0-1715928259222.png

1.I create a calendar table and create a relationship among the table.

vxinruzhumsft_1-1715928310180.png

2.Create a measure.

MEASURE =
VAR a =
    DATE ( MAX ( 'Calendar'[Year] ), MONTH ( MAX ( 'Calendar'[Date] ) ), 1 )
VAR b =
    a - WEEKDAY ( a, 2 ) + 1
VAR c =
    a + 7
        - WEEKDAY ( a, 2 )
RETURN
    CALCULATE ( SUM ( 'Table'[Value] ), DATESBETWEEN ( 'Calendar'[Date], b, c ) )

3.Put the following field to the matrix visual. the date column is belong to the data table not the calendar table.

vxinruzhumsft_2-1715928397321.png

Output

vxinruzhumsft_3-1715928455031.png

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

2 REPLIES 2
Anonymous
Not applicable

Hi @dwelsh 

You can refer to the following sample data.

Sample data 

vxinruzhumsft_0-1715928259222.png

1.I create a calendar table and create a relationship among the table.

vxinruzhumsft_1-1715928310180.png

2.Create a measure.

MEASURE =
VAR a =
    DATE ( MAX ( 'Calendar'[Year] ), MONTH ( MAX ( 'Calendar'[Date] ) ), 1 )
VAR b =
    a - WEEKDAY ( a, 2 ) + 1
VAR c =
    a + 7
        - WEEKDAY ( a, 2 )
RETURN
    CALCULATE ( SUM ( 'Table'[Value] ), DATESBETWEEN ( 'Calendar'[Date], b, c ) )

3.Put the following field to the matrix visual. the date column is belong to the data table not the calendar table.

vxinruzhumsft_2-1715928397321.png

Output

vxinruzhumsft_3-1715928455031.png

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.

 

 

 

 

 

 

This worked! Thank you so much for your help.

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.