Best Of
Re: STR_TO_DATE
@RayRay_H It looks like there may be a space after the date in the error message. Try replacing the spaces with an empty string before using the STR_TO_DATE function
STR_TO_DATE(REPLACE(`Date`,' ',''),'%d-%b-%y')
Re: How to reference a Beast Mode in antother Beast Mode
@PJG if its not something that will be impacted by filters then you can add that specific beast mode as a formula in an ETL and then use that field in a beast mode. Formula tiles make it easier to reference actual columns and not just the code.
Ashleigh
Re: Field Use Export
@renee12345 Yes, you can use the "Card Fields with Beast Modes" report from the Domo Governance connector. It will tell you which fields are used on each card.
Re: CASE WHEN X IS NULL THEN Previous Value
@nicangelica this one is a brain teaser.
assume we are trying to capture the last time 'cost changed'
1) window function calculate the previous cost (lag, 1)
2) create a binary (isCostChanged) using a CASE statement.
3) take the cumulative sum of isCostChange using window function (sum). at this point you should basically have a counter. in the initial example, rows 1-4 would be group 1, rows 5 would be group 2, row 6-8 would be group 3, rows 9 would be group 4.
4) take the cumulative sum of cost partitioned by group. -- this will give you cost from the first row of each group.
you can do this in SQL or in Magic ETL.
Re: MySQL Recursive CTE - Date Range Split
If you SELECT VERSION() you'll see which version of MySQL you're developing against, MySQL 5.6,
https://dev.mysql.com/doc/refman/8.0/en/with.html
MySQL 5.6 does not support CTEs ![]()
But if you have a list of Dates (a date dimension) you could accomplish the same thing with a simple JOIN
SELECT
a.*
FROM
a
Join
Date d
on d.date between startDate and endDate
or similar.


