cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ashaikh Member
Member

Start and End Date of a week

Hello,

 

I am creating weely reports for which I Week Duration which is calculated by Start Date and End Date of the week. This the formula I am using

 

 

WEEK DURATION = vRCCLCOMBINED[START DATE] & " - " & vRCCLCOMBINE[END DATE]

START DATE:

 

START DATE =
FORMAT (
    (
        vRCCLCOMBINED[START TIME] - WEEKDAY ( vRCCLCOMBINED[START TIME], 1 )
            + 1
    ),
    "MM/DD/YYYY"
)

END DATE:

 

 

END DATE =
FORMAT (
    (
        vRCCLCOMBINED[START TIME] - WEEKDAY ( vRCCLCOMBINED[START TIME], 1 )
            + 7
    ),
    "MM/DD/YYYY"
)

 

Now here is not the issue, but where I want to make changes is in case when Start of the year is with in the week.

 

Say for example, 01/01/2018 it starts on Monday so I want the START DATE 01/01/2018 and END DATE 01/06/2018. But for following week START DATE  01/07/2018 and END DATE 01/13/2018

 

Similary for last week of year 2017 should have START DATE 12/31/2018 and END DATE 12/31/2018

 

So the Output will look like below:

 

START DATE | END DATE  | WEEK DURATION          |
-----------|-----------|------------------------|
12/24/2017 |12/30/2017 |12/24/2017 - 12/30/2017 |
12/31/2017 |12/31/2017 |12/31/2017 - 12/31/2017 |
01/01/2018 |01/06/2018 |01/01/2018 - 01/06/2018 |
01/07/2018 |01/13/2018 |01/07/2018 - 01/13/2018 |

 

Thanks

Abdulquadir

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Start and End Date of a week

You should be able to easily modify the quick measures that I have here for this:

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/First-Last-Working-Days/m-p/391545


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!


2 REPLIES 2
Super User
Super User

Re: Start and End Date of a week

You should be able to easily modify the quick measures that I have here for this:

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/First-Last-Working-Days/m-p/391545


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!


Highlighted
Vikram1 Frequent Visitor
Frequent Visitor

Re: Start and End Date of a week

Week Start & End Date From Date Dax Formula

 

WeekStartDate = [DateColumn] - (WEEKDAY([DateColumn])-1)

WeekEndDate = [DateColumn] + (7-WEEKDAY([DateColumn]))