WEEKOFYEAR() should be removed from the approved function list or it's behavior should be changed
Having a function to act as a synonym for another function is pretty misleading. Especially when that functionality is different from other implementations of the function.
Make it so WEEKOFYEAR() returns the week number for a given date while assuming the week starts on Monday. Otherwise the function should be deprecated.
Best Answer
-
Thanks for bringing this up Zac. We've updated the in-place Magic ETL documentation for the WEEKOFYEAR() function. The new docs will mention the discrepency with MySQL and recommend that WEEK() always be used over WEEKOFYEAR() in the current version of Magic ETL. We can't immediately change the existing behavior of WEEKOFYEAR(), of course, but we're looking into ways we might do it eventually. We don't try to guarantee perfect behavioral parity with MySQL, but we do try to avoid gotchas like this one.
Randall Oveson <randall.oveson@domo.com>
2
Answers
-
Beast mode functions tend to follow the MYSQL definition.
https://www.w3schools.com/sql/func_mysql_weekofyear.aspWhere are you see inconsistencies? I got the same result in my card and the w3schools editor when entering in 6/19/2023.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
WEEKOFYEAR('2023-06-19') should return 25 but WEEKOFYEAR('2023-06-18') also returns 25. WEEKOFYEAR('2023-06-17') returns 24.
According to that testing, WEEKOFYEAR() assumes the week starts on a Sunday, but the documentation on w3schools that you shared states that the function assumes the week starts on a Monday per MySQL 4.0.
When you execute 'SELECT WEEKOFYEAR('2023-06-19');' on w3's editor, it returns a 25 but 'SELECT WEEKOFYEAR('2023-06-18');' returns 24.
Furthermore, the function description on MagicETL's formula editor states that "WEEKOFYEAR() is a synonym for WEEK().". It looks like you can pass in an additional argument for the 'MODE', but that isn't the norm for WEEKOFYEAR().
Making it so you have to pass an additional argument to get the function to act like it should is misleading. Making it so you have two functions that do the same thing when their behavior is different in other SQL environments is misleading.
0 -
I agree with you that it doesn't appear to operating the same as the indicated definition in the formula editor. I would suggest sending it in as a bug to support@domo.com and see if they will fix it. In the meantime, I would use WEEK() as you definitely have more control with the extra parameter options.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
Thanks for bringing this up Zac. We've updated the in-place Magic ETL documentation for the WEEKOFYEAR() function. The new docs will mention the discrepency with MySQL and recommend that WEEK() always be used over WEEKOFYEAR() in the current version of Magic ETL. We can't immediately change the existing behavior of WEEKOFYEAR(), of course, but we're looking into ways we might do it eventually. We don't try to guarantee perfect behavioral parity with MySQL, but we do try to avoid gotchas like this one.
Randall Oveson <randall.oveson@domo.com>
2 -
That is awesome! Nice to see that Domo employees watch these threads. Appreciate you hopping on the topic and acting quickly
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 101 SQL DataFlows
- 623 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 748 Beast Mode
- 60 App Studio
- 41 Variables
- 690 Automate
- 177 Apps
- 455 APIs & Domo Developer
- 48 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 397 Distribute
- 114 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 127 Manage
- 124 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 109 Community Announcements
- 4.8K Archive