Starting Day of the Week - Monday

Zel
Zel Member

Hello, can anyone help me find a solution on how I could start with Monday for the weekly data? My data is dynamic, so it has to update on a weekly basis - I used Last 4 weeks.

I have a table with weekly data showing like the one below,

and when I created a bar chart in DOMO, originally, when graphed weekly, it will start with Sunday data.

Thank you and hope someone could help me :)

Tagged:

Best Answers

  • david_cunningham
    Answer ✓

    If this is going to be a consistent, recurring use-case. I.e. you’re going to want other cards to replicate the same behavior. I’d recommend using the fiscal calendar option in Domo. When setting it up you’ll be able to specify your week start date.

    You can then either toggle that setting on/off to use your Monday start date or the default.

    Link to article about fiscal calendar.

    https://domo-support.domo.com/s/article/360042924254?language=en_US

    David Cunningham

    ** Was this post helpful? Click Agree 😀, Like 👍️, or Awesome ❤️ below **
    ** Did this solve your problem? Accept it as a solution! ✔️**

  • MichelleH
    MichelleH Coach
    Answer ✓

    @Zel I second @david_cunningham's recommendation about a fiscal calendar. If this is only a requirement for this card, then I suggest creating a beast mode to transform your date field to the most recent Monday to use for your series like this:

    case 
      when DAYNAME = 'Sunday' then DATE_SUB(`Date`,interval 6 day)
      else `Date` - DAYOFWEEK(`Date`) + 2
    end
    

  • DashboardDude
    Answer ✓

    Hi @Zel ,

    I hope I can help. Here is where I have some SQL formulas to help: https://www.dashboarddudes.com/recipes

    If you look at "Round dates to previous monday" you can see this formula:

    Date-weekday(Date -1)+1 (if doing in a beast mode). Let me know if that helps

    John Le

    Let me make you the me of your organization for Domo

    Click here for more video solutions: https://www.dashboarddudes.com/pantry

Answers

  • david_cunningham
    Answer ✓

    If this is going to be a consistent, recurring use-case. I.e. you’re going to want other cards to replicate the same behavior. I’d recommend using the fiscal calendar option in Domo. When setting it up you’ll be able to specify your week start date.

    You can then either toggle that setting on/off to use your Monday start date or the default.

    Link to article about fiscal calendar.

    https://domo-support.domo.com/s/article/360042924254?language=en_US

    David Cunningham

    ** Was this post helpful? Click Agree 😀, Like 👍️, or Awesome ❤️ below **
    ** Did this solve your problem? Accept it as a solution! ✔️**

  • MichelleH
    MichelleH Coach
    Answer ✓

    @Zel I second @david_cunningham's recommendation about a fiscal calendar. If this is only a requirement for this card, then I suggest creating a beast mode to transform your date field to the most recent Monday to use for your series like this:

    case 
      when DAYNAME = 'Sunday' then DATE_SUB(`Date`,interval 6 day)
      else `Date` - DAYOFWEEK(`Date`) + 2
    end
    

  • Zel
    Zel Member
    edited May 16

    Hi, @david_cunningham and @MichelleH , thank you for looking into this. I will be using it for 2 cards.

    I tried the beast mode you sent, but getting an error. 🙁

  • MichelleH
    MichelleH Coach
    edited May 16

    @Zel Apologies, I forgot to include the date field in the DAYNAME function. It should look like this:

    case 
      when DAYNAME(`Date`) = 'Sunday' then DATE_SUB(`Date`,interval 6 day)
      else `Date` - DAYOFWEEK(`Date`) + 2
    end
    

  • Zel
    Zel Member

    @MichelleH thank you for the quick response. I tried using the beast mode but still getting the same dates at the bottom.

  • @Zel Try changing the Graph by in your chart to "None". When it is set to "Week", the chart will still convert all weeks to starting on Sunday, so you want to bypass the default date grouping.

  • Zel
    Zel Member

    I see. Thank you for letting me know. Is there a workaround for this view? Just like what we have in the previous snapshots.

  • Zel
    Zel Member

    @MichelleH I see. Thank you for letting me know. Is there a workaround for this view? Just like what we have in the previous snapshots.

  • @Zel If you don't want the date gaps, you can convert the dates to a string using the DATE_FORMAT function:

    DATE_FORMAT(case 
      when DAYNAME(`Date`) = 'Sunday' then DATE_SUB(`Date`,interval 6 day)
      else `Date` - DAYOFWEEK(`Date`) + 2
    end,
    '%Y-%m-%d'
    )
    

    Note that if you do this, you will need two versions of this beast mode: one in a string format for the X-axis values, and one in date format for the date filters.

  • Zel
    Zel Member

    @MichelleH I tried doing that and I'm getting the result below. Apologies for the questions. Please bear with me 😅 I really appreciate your efforts.

    and these are 2 beast modes: string format and date format

  • @Zel Can you confirm if the Monday Test2 (X-axis) field is in a string format? Does the pill in Analyzer show "abc" or a calendar icon? If it's a calendar, you may need to wrap the entire formula in a CONCAT function.

  • DashboardDude
    Answer ✓

    Hi @Zel ,

    I hope I can help. Here is where I have some SQL formulas to help: https://www.dashboarddudes.com/recipes

    If you look at "Round dates to previous monday" you can see this formula:

    Date-weekday(Date -1)+1 (if doing in a beast mode). Let me know if that helps

    John Le

    Let me make you the me of your organization for Domo

    Click here for more video solutions: https://www.dashboarddudes.com/pantry

  • Zel
    Zel Member

    thank you all for your help 😊