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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Tajkment
New Member

Weeknum - weeks covering 9 days

Hi,

I have been putting together a custom financial year callendar, i have realised that the Weeknum dax is returning the same week number for the range of 9 days, is there a way to fix it?

Example below

Thank you in advance for any advice

Tajkment_0-1719927806184.png

 

1 ACCEPTED SOLUTION

@Tajkment How about this? 

Column 3 = 
    VAR __Date = [Date]
    VAR __StartDate = DATE( 2024, 7, 1 )
    VAR __StartDay = WEEKDAY( __StartDate )
    VAR __Result = COUNTROWS( FILTER( 'Calendar', [Date] <= __Date && [Date] >= __StartDate && WEEKDAY([Date]) = __StartDay ) )
RETURN
    __Result


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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Tajkment
New Member

@Greg_DecklerYou are 100% right,  that is not what i would like,

any advices what should i use instead?

Thank you


@Tajkment That would depend on what exactly you are trying to achieve. How is it supposed to work? When does your financial year start and end?



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

I am looking to generate an financial year callendar, The financial year runs from July to June, so i would get Financial Year,month, quarter, week, the week is starting on Monday,

The end goal is to use this one as a slicer, so the end users will be able to filter the visualisations by year / quarter / month / week

@Tajkment How about this? 

Column 3 = 
    VAR __Date = [Date]
    VAR __StartDate = DATE( 2024, 7, 1 )
    VAR __StartDay = WEEKDAY( __StartDate )
    VAR __Result = COUNTROWS( FILTER( 'Calendar', [Date] <= __Date && [Date] >= __StartDate && WEEKDAY([Date]) = __StartDay ) )
RETURN
    __Result


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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

@Tajkment Don't use EDATE? You are using EDATE with a -6. This means that August 29th through 31st will all return a date of February 29th, which is 6 months back from August. Since February doesn't have a 30th or 31st, those will both return 29th of February or last date in February. So, probably not what you want.



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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.