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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
victoryamaykin
Advocate I
Advocate I

Week per month that starts over every 4 weeks

I want to count each sales week of the month from 1 to 4, so that I can apply a color to the week ( 1 = red, 2 = blue, etc.). 

Here's what I tried so far, which works up until the end of February. I want to restartt the count from 1 to 4 for the week numbers as shown in the table below. Thanks for your time. 

 

        "Week Ending", [Date] - WEEKDAY( [Date], 1) + 7, 
        // Use the last week number of month to reset the counting, min week number = 1, max week number = 4
        "Week in Month", IF( WEEKNUM( [Date]) > 4, WEEKNUM( [Date] ) - 4, WEEKNUM( [Date]))

 

 

DateWeek in MonthDesired Week in Month
2/18/202444
2/19/202444
2/20/202444
2/21/202444
2/22/202444
2/23/202444
2/24/202444
2/25/202451
2/26/202451
2/27/202451
2/28/202451
2/29/202451
3/1/202451
3/2/202451
3/3/202462
3/4/202462
3/5/202462
3/6/202462
3/7/202462
3/8/202462
3/9/202462
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @victoryamaykin ,

 

As @Jihwan_Kim  said, you can use the mod function to process the data:

Column =
VAR _num = MOD([Desired Week in Month],4)
RETURN
IF(_num = 0, 4, _num)

Let me explain in detail how to change the background color of this week.
1. After creating the table, right-click the date field -> Conditional Formatting -> Background Color.

vkaiyuemsft_0-1709000038245.png

2. Make the following settings in the window.

vkaiyuemsft_1-1709000057802.png

3. The final result is shown in the figure below.

vkaiyuemsft_2-1709000076589.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

3 REPLIES 3
Anonymous
Not applicable

Hi @victoryamaykin ,

 

As @Jihwan_Kim  said, you can use the mod function to process the data:

Column =
VAR _num = MOD([Desired Week in Month],4)
RETURN
IF(_num = 0, 4, _num)

Let me explain in detail how to change the background color of this week.
1. After creating the table, right-click the date field -> Conditional Formatting -> Background Color.

vkaiyuemsft_0-1709000038245.png

2. Make the following settings in the window.

vkaiyuemsft_1-1709000057802.png

3. The final result is shown in the figure below.

vkaiyuemsft_2-1709000076589.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

Thank you for the detailed response. It's working as intended. I used a custom column to make a legend for future visuals. Thanks again

victoryamaykin_0-1709047594692.png

 

Jihwan_Kim
Super User
Super User

Hi,

One of ways is to use MOD dax function.

 

Returns the remainder after a number is divided by a divisor

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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