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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
victoryamaykin
Frequent Visitor

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
v-kaiyue-msft
Community Support
Community Support

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
v-kaiyue-msft
Community Support
Community Support

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.


Go to My LinkedIn Page


Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors