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
Dunner2020
Post Prodigy
Post Prodigy

RY Week number

Hi @amitchandak ,

 

I am following your youtube tutorial (https://www.youtube.com/watch?v=q_Ke80KNcEw) to create the RY week no. I noticed that 

The formula I have written for FY week is as follow:

RY Week = QUOTIENT(DATEDIFF(MINX(FILTER(dates,Dates[Regulatory Year]=EARLIER(Dates[Regulatory Year])),Dates[Week Starting]),Dates[Date],DAY),7)+1
 
However, I noticed that my RY week number values go up to 90 :). I have attached the file for your review. Could you please point me out where I made the mistake?
 
3 REPLIES 3
amitchandak
Super User
Super User

@Dunner2020 , I checked it. It because of FY. I have used Endofyear for FY end date. And Using today as the end date. As Endofyear do not go beyond the calendar date. So for last year, FY end date is incorrect and it was creating the wrong end date.

 

I correct calendar like

Date = CALENDAR(date(2013,04,01),date(2021,03,01))

 

OR you can create an FY like, Based your need

If(month([Date])<=3, year([Date]) -1, Year([Date]))  // This can any month

@amitchandak , Thanks for the clarification. I generated the RY Year the way you mentioned in your reply and it fixed the problem.However, I noticed that Week Rank is producing value upto 367. The formula is used for Week Rank is 

Week Rank = RANKX(ALL(Dates),Dates[Week Starting],,ASC,Dense)
 
and the Week Starting is calculated using the following formula:
Week Starting = Dates[Date]-Dates[Day In Week]
 
I did not add 1 in Week starting as in my data Day in Week starts from 0 (i.e. Monday). Could you please advise how to fix that issue?
 
 
 
 

Hi @Dunner2020,

It should work as a general weeknum function to return the correct week number if you are working with a common calendar table and filtered based on the year field. 

 

RW =
RANKX (
    FILTER ( 'Table', YEAR ( [Date] ) = YEAR ( EARLIER ( 'Table'[Date] ) ) ),
    [Week start],
    ,
    ASC,
    DENSE
)

 

Since your table needs to calculated based on the fiscal fields. If RYear field does not work well with the above expression, I think you may need to add offset to modify these fiscal fields to make them work as common calendar fields.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.