cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

First Day of week

Hi,

 

My week runs Saturday to Friday,

 

is there a way in dax i can get the week no and year? as currently i only have the option in dax for Sunday to monday

5 REPLIES 5
Highlighted
Continued Contributor
Continued Contributor

Re: First Day of week

Hi @Kbrennan856,

 

I hope it helps you:

 

https://msdn.microsoft.com/en-us/library/mt260707.aspx

 

Thanks,

 

Ricardo

Highlighted
Resolver I
Resolver I

Re: First Day of week

Hi @Kbrennan856,

 

You can do the SWITCH function like below:

 

Weekday = 
SWITCH(
    TRUE();

    "Saturday"; 0 ;
    "Sunday"; 1 ;
    ...;

    "Friday"; 6 )

 

I hope it helps you.

Best regards,

Highlighted
Frequent Visitor

Re: First Day of week

Hi,

 

thanks for your reply, here is an example of what i need

 

i have a date column ie 2018-02-16

and i need another column with the week number. My week no should be 7 as i use saturday as frist day of the week but dax will return me 6

Highlighted
Resolver I
Resolver I

Re: First Day of week

Hi,

 

You can include one column with weekday_name, then to do the SWITCH function based on the weekday_name. 

 

I hope it helps you.

Best regards,

Highlighted
Community Support
Community Support

Re: First Day of week

Hi @Kbrennan856,

 

You can use below formula to get Week Number from Saturday to Friday.

 

Calculate column formula:

weeknum =
VAR _calendar =
    FILTER (
        ADDCOLUMNS ( 'Calendar', "WeekDay", WEEKDAY ( [Date], 1 ) ),
        YEAR ( [Date] ) = YEAR ( EARLIER ( [Date] ) )
    )
RETURN
    COUNTROWS (
        FILTER ( _calendar, [Date] <= EARLIER ( [Date] ) && [WeekDay] = 7 )
    )
        + 1

 

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
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors