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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
gsmith_eqd
Frequent Visitor

Week + Month column

I'm trying to make a column on my calendar table that concatenates the Weeknumber and Month and contains both months when a week spans 2 months. Here's a small sample to demonstrate the behavior I'm hoping to achieve:

 

Jan Week 1

Jan Week 2

Jan Week 3

Jan Week 4
Jan/Feb Week 5
Feb Week 6

 

On my calendar table I have the columns Date, Year, Day, MonthNumber, Month, Weeknum. Here's what I've tried:

 

Week+Month =
VAR __Week = 'Calendar'[Weeknum]
VAR __Day1 = CALCULATE(FIRSTDATE('Calendar'[Date]), 'Calendar'[Weeknum] = __Week)
VAR __Day2 = CALCULATE(LASTDATE('Calendar'[Date]), 'Calendar'[Weeknum] = __Week)
VAR __Month1 = LEFT(LOOKUPVALUE('Calendar'[Month], 'Calendar'[Date], __Day1), 3)
VAR __Month2 = LEFT(LOOKUPVALUE('Calendar'[Month], 'Calendar'[Date], __Day2), 3)
RETURN

IF(__Month2 = __Month1, __Month1 & " Week " & __Week, __Month1 & "/" & __Month2 & " Week " & __Week)

 

But this still yields this:

 

Jan Week 1

Jan Week 2

Jan Week 3

Jan Week 4
Jan Week 5
Feb Week 5

 

It seems like maybe FirstDate and LastDate aren't working how I'm expecting them to, but I'm not sure what the alternative is.

 

Any advice is appreciated!

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@gsmith_eqd Try adding a sequential week number column in your table first, like this: Sequential - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Capture.PNGThanks for the response, @Greg_Deckler  

 

If you look at my initial post, what I want is column that displays the month name and the week number and contains both month names if the week spans two months. The reason for this is that the report I'm creating displays weekly Sales numbers over the past 12 weeks on a bar chart. However, if I simply use the weeknum, month, and year as the X axis values like in the attached image, then it will display a week twice - once in January and once in February. It seems like displaying the weeks sequentially would help if I didn't want to display the month, but I do want to display the month on the visual. In this case I also think it would be confusing for the viewer to see "Week 105" instead of "Week 1" or something like that.

 

Maybe there's something I'm missing here, but I really just want to be able to concatenate the month names when a week spans 2 months. This would totally solve the problem.

 

Let me know if you have any suggestions and thanks again!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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