Forum Discussion

csudude's avatar
csudude
Frequent Visitor
6 years ago

Start Of Week

I'm in the processing of migrating my companies reports from Tableau to Power BI. However, I'm new to Power BI and I have a lot to learn. 

 

In Tableau, I can quickly select the start of the week.  This is from Tableau Desktop: 

 

Is there a way to do this in Power BI Desktop? I am trying to filter on the last 12 calendar weeks.  Below is a screenshot from Power BI, it shows 7/14 as the start of the week.  That is a Sunday.  However, I'd like to tell Power BI that Monday is the start of the week and should show 7/15: 

Any suggestions? 

 

5 Replies

  • v-lid-msft's avatar
    v-lid-msft
    Community Support

    Hi csudude ,

     

    We can add a calculated column based on your date column, get the weeknumber start by Monday.

     

    Please read this document to get detail about WEEKNUM function: https://dax.guide/weeknum/

     

    Week = WEEKNUM([Date],2)

     

    Then you can create silcer based on this column.

     

     


    BTW, pbix as attached.

     

    Best regards,

    Community Support Team _ Dong Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • csudude's avatar
    csudude
    Frequent Visitor

    Thanks for the replies.

     

    v-lid-msft Your information is helpful but not for this particular problem.  In addition to setting Monday to the start of the week, I need to filter on the last 12 weeks.  I need relative date filtering which I cannot do on an integer. 

     

    I created a start of week date column in my date table that sets Monday to the start of the week: 

    SoW = Dates[Date] - WEEKDAY(Dates[Date],2) + 1

     

    After that, I used my SoW column in the date filter:

    However, the filter still shows 7/14 (Sunday) to 10/5 (Saturday) and not 7/15 to 10/6 like I would prefer. Internally, Power BI is still recognizing Sunday as the start of the week. That's why I was hoping PBI had something like Tableau where I can tell Tableau Desktop / the data source that Monday is the start of the week and filters would reflect that.  

     

    The good news is despite the incorrect dates being displayed in the filter, I am getting the values I expected.  I was worried that for the week of 9/30 (Monday) values for 10/6 (Sunday) would be excluded due to the filter showing 7/14/19-10/5/19.

     

    • v-lid-msft's avatar
      v-lid-msft
      Community Support

      Hi csudude ,

       

      We can create a parameter as a workaround to meet your requirement.

       

       

      Then create a measure to judge the condition:

       

      isInLastWeek =
      IF (
          ISFILTERED ( LastWeekNumber[LastWeekNumber] ),
          IF (
              MAX ( 'Table'[Week] )
                  >= WEEKNUM ( TODAY (), 2 ) - [LastWeekNumber Value]
                  && MAX ( 'Table'[Week] ) <= WEEKNUM ( TODAY (), 2 ),
              1,
              0
          ),
          1
      )

      Put it into the Visual Filter and set greater than 0.

       


      BTW, pbix as attached.

       

      Best regards,

      Community Support Team _ Dong Li
      If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • v-lid-msft's avatar
      v-lid-msft
      Community Support

      Hi csudude ,

       

      How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?

       

      Best regards,

      Community Support Team _ Dong Li
      If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.