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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vjnvinod
Impactful Individual
Impactful Individual

Incorrect Month

 

I am seeing some issues with my calendar table

Week5 is technically should be P01, but its shown as P02

 

this is the formula I am using for month number

MonthNumber =
MONTH ( 'Date'[Date] )
 
The last week of July should be always July month number, in this case, it comes as 7 & 8, as a result, my Fiscal month number is incorrect
 
How do I fix the below formula?
 
MonthNumber =
MONTH ( 'Date'[Date] )
so that the last week of any month should be same number of that month

 

vjnvinod_0-1644158231760.png

 

8 REPLIES 8
v-yalanwu-msft
Community Support
Community Support

Hi,  @vjnvinod ;

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? Then we could close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yalanwu-msft 

 

i managed to get this resolved by using

Month number and week start date combination

v-yalanwu-msft
Community Support
Community Support

Hi, @vjnvinod ;

You could try it.

MonthNumber =
MONTH ( 'Date'[Week End] )

 

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

mahoneypat
Employee
Employee

Please see if this calendar table is useful.

445 Calendar with 53-Week Years – Hoosier BI

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


vjnvinod
Impactful Individual
Impactful Individual

@mahoneypat 

 

544 with the 52-week calendar is what I am trying to build?

Do you have a sample pbix you have handy to use?

Are you comfortable adapting the M code from that article to meet your needs? It shouldn't take much I think.

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


vjnvinod
Impactful Individual
Impactful Individual

@mahoneypat 

I can try, but what happens to those M Code next year? will that work?

Not sure what you mean, but a simpler solution might be to add a column with this expression to your existing Date table query. You can adapt if you week starts on a different day, but this will calculate the fiscal month based on the month of the first day of that week.

 

= Date.Month(Date.StartOfWeek([Date], Day.Sunday))

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.