Best Of
Re: Adding Space to Postal Code TEXT String in Magic ETL
If your postal codes are the same length and you want to add it after the 3rd character, you can do this:
CONCAT(LEFT(postalcode,3),' ',RIGHT(postalcode,3))
Community Experiences at Virtual Domopalooza
You probably heard that Domopalooza has gone 100% virtual. As we prepare to shift from a live event to a virtual event we will adjust the community experiences accordingly. We value our community members, and still want this to be a learning experience and a way to connect with other Domo users. We will provide more details about the updated format for the community events shortly. If you have questions about refunds or reservations for Domopalooza please contact your CSM. We look forward to connecting with all of in March!
Re: Replace Text Regex - IP Address Regex
You rang @MarkSnodgrass ? 😀
You're close you just need to tell the regex what groupings you wish to capture with parenthesis. Also I prefer the new formula tile as it tends to work a little bit better.
REGEXP_REPLACE(`ip_address`, '^.*199\.15\.([0-9]{1,3})\.([0-9]{1,3}).*$', '$1')
For others who may come across this post as it seems you understand regex's fairly well:
^.* says to start at the beginning and match any character 0 or more times
199\.15\.
matches the IP prefix filter
([0-9]{1,3})
Matches a number (0-9) 1-3 times and stores it in a match group. the first is stored in $1 and the second is stored in $2
.*$ says to match any character 0 or more times at the end.
I'm matching the entire string ^.....$ in this case because I only want to pull out the specific value. Domo's regex doesn't have a way to specifically pull out a match so we need to replace the entire string with the value we're looking for. A caveat to this is that it will return the entire string if it doesn't match the regular expression. If you want to return an empty string instead of the full string you could do something like:
CASE WHEN REGEXP_LIKE(`ip_address`, '^.*199\.15\.([0-9]{1,3})\.([0-9]{1,3}).*$') THEN
REGEXP_REPLACE(`ip_address`, '^.*199\.15\.([0-9]{1,3})\.([0-9]{1,3}).*$', '$1')
ELSE
''
END
Re: Line Graphic with YTD Data (cumulative total each month)
@bp_paulo_fernandes have you looked at @GrantSmith 's post regarding running totals in beast mode?
https://dojo.domo.com/discussion/52681/domo-ideas-conference-beast-modes-running-totals#latest
He lays this out pretty nicely.
Re: Adding business days to a date via MagicETL
Hi @adamxor
I just gave a presentation at Domopalooza on beast modes and I discussed this scenario. There's even a write-up here on the Dojo that I did as well: https://dojo.domo.com/discussion/54551/dp22-using-beast-mode-to-build-data-storytelling-adding-business-days
DP22 - Using Beast Mode to Build Data Storytelling - Adding Business Days
This post is part of a series of beast modes I presented on during my “Using Beast Mode to Build Data Storytelling” Domopalooza 2022 session. If you find this post helpful please make sure to give it a like or an awesome below.
Use Case
When evaluating different carriers for performance we needed a simplistic calculation to quickly determine how often they were delivering packages on time. The delivery days promised by the carriers are in business days however the days an order was shipped and when it was delivered are actual calendar days. This beast mode allows us to add a specific number of business days to a date to compare to when a delivery was made. This calculation assumes a work week of Monday through Friday and doesn’t consider the days in which the business was closed (for example holidays).
Beast Mode
`Ship Time` + INTERVAL ( FLOOR(`Estimated Delivery Days`/5) * 7 + CASE WHEN MOD(`Estimated Delivery Days`,5) + DAYOFWEEK(`Ship Time`) >= 7 THEN 2 - FLOOR(DAYOFWEEK(`Ship Time`)/7) ELSE 0 END + MOD(`Estimated Delivery Days`,5) ) DAY
Beast Mode Breakdown
FLOOR(`Estimated Delivery Days`/5) * 7
`Estimated Delivery Days`/5 converts the business days into calendar weeks as there are 5 business days per week (Monday - Friday).
FLOOR returns the whole number rounded down to get the number of full weeks. Partial weeks will be added later.
Multiply by 7 to convert to calendar days
DAYOFWEEK(`Ship Time`)
DAYOFWEEK takes a date and returns a value for the number of the day of the week (1 – Sunday … 7 – Saturday)
MOD(`Estimated Delivery Days`,5)
This is the number of business days left in the partial business week
CASE WHEN MOD(`Estimated Delivery Days`,5) + DAYOFWEEK(`Ship Time`) >= 7 THEN
Putting these both into In simpler terms - Does the partial week cause us to go into the weekend (beyond Saturday / day 7)?
FLOOR(DAYOFWEEK(`Ship Time`)/7)
Returns 0 for Sunday – Friday, 1 for Saturday. DAYOFWEEK will return 1-6 Sunday-Friday and 7 for Saturday. Dividing this by 7 returns a number < 1 for Sunday-Friday and 1 for Saturday. FLOOR converts any decimal less than 1 to be 0 by dropping the decimals. This is an alternative way to do
CASE WHEN DAYOFWEEK(`Ship Time`) = 7 THEN 1 ELSE 0 END
2 - FLOOR(DAYOFWEEK(`Ship Time`)/7)
If the start date was Saturday only add one day to get throught the weekend instead of the standard 2 days
MOD(`Estimated Delivery Days`,5)
Use the MOD function to divide the estimated business days we’re adding and get the remaining to add to the calendar date.
Final Result
Bonus - On Time Deliveries
We can take this one step further and use another CASE statement to bucket our deliveries into either On-Time or Late
CASE WHEN `Delivery Time` <= (`Ship Time` + INTERVAL ( FLOOR(`Estimated Delivery Days`/5) * 7 + CASE WHEN MOD(`Estimated Delivery Days`,5) + DAYOFWEEK(`Ship Time`) >= 7 THEN 2 - FLOOR(DAYOFWEEK(`Ship Time`)/7) ELSE 0 END + MOD(`Estimated Delivery Days`,5) ) DAY) THEN 'On-Time' ELSE 'Late' END
First Ever Virtual Community Awards Ceremony
Formerly an exclusive in-person event, we're now opening our Community Awards Ceremony to the entire community! To close out Domopalooza week, join us as we highlight and award top contributors to Domo's community this past year. This is not only a great opportunity to get to know and congratulate fellow Domo users, but collaborate as we participate in activities together.
You can expect:
- Awards Ceremony
- Domo & Data Trivia with Prizes
- Breakout room collaboration challenge with prizes
When: March 24th, 10am MT
Where: Zoom
REGISTER NOW HERE.
See you soon,
Domo Community Team
Re: Slack Data Connector
Domo has a Slack Quickstart in the appstore that will not only create the connector, but build a page full of cards for you to help you quickly see what kind of visualizations you might make with the data. Search for Slack in the appstore and you should see Slack Quickstart.
Hope this helps.
DP22 - Using Beast Mode to Build Data Storytelling
This post is the supplement to my presentation “Using Beast Mode to Build Data Storytelling” at my Domopalooza 2022 session. Over the course of that session I talked about several use cases and went over beast modes how to handle those use cases. I also discussed and talked about defining custom period over period definitions. I've outlined links below to posts outlining the different use cases and a breakdown of each. If you find this post or any of the related posts helpful please make sure to give it a like or an awesome below.
Beast Modes:
Re: Pulling out UTM parameters for new columns
Regular expressions are your friend here for parsing this out of your URL string. You'd need different columns but you can do this all in the same Formula tile using different regular expressions:
utm_source:
REGEXP_REPLACE(`url`, '^.*utm_source=([^&]+).*$', '$1')
utm_content:
REGEXP_REPLACE(`url`, '^.*utm_content=([^&]+).*$', '$1')
utm_campaign:
REGEXP_REPLACE(`url`, '^.*utm_campaign=([^&]+).*$', '$1')
utm_medium:
REGEXP_REPLACE(`url`, '^.*utm_medium=([^&]+).*$', '$1')
fbclid:
REGEXP_REPLACE(`url`, '^.*fbclid=([^&]+).*$', '$1')
By default if the regular expression doesn't match it'll return the original value. You could wrap these in CASE statements and using the REGEXP_LIKE function to conditionally return an empty string if it's not found.
utm_medium:
CASE WHEN REGEXP_LIKE(`url`, '^.*utm_medium=([^&]+).*$') THEN REGEXP_REPLACE(`url`, '^.*utm_medium=([^&]+).*$', '$1') ELSE '' END
Regex Breakdown
^ - Start at the beginning of the string
.* - Match any character . 0 or more times *
utm_medium= Exactly match the string 'utm_medium='
([^&]+) Parenthesis tell the regex to store the result into a variable ($1 in this case as it's the first match defined in our regular expression) [^&] tell the regular expression to not ^ match the & character 1 or more times +
$ Match the end of the string
By matching the beginning and end of the string and using the replace it will replace the entire string with the value we found in our first match defined in $1






