Transforming Data before a Join
Hello,
I've been trying out DOMO for a week now, and it seems to work a bit different than other BI tools. What I want to do, is add a calculated column to a table, based on a formula (in this case, based on DATEDIFF since I want to calculate Age from Date of Birth). After this, I want to add a conditional column Age Group, that organizes the different Ages into their corresponding Age Groups.
Now I know I can accomplish this easily by a few beastmodes, but the problem is that (if I'm right) this only creates virtual columns to use directly in charts. I want to add the columns mentioned above, and then join another table based on the Age Group values.
I already looked at Magic ETL but it doesn't seem to be possible there. Would this be possible by using SQL? Or is this even possible at all within DOMO?
Best Answer
-
This is definitely something that can be handled in a MySQL dataflow.
Select
*,
floor(datediff(curdate(),`Date_of_Birth`)/365) as `Age`
from data_table
then you can use the `Age` field to create your `Age Bucket` Field:
select
*,
case when `Age`<18 then 'Minor'
when `Age`<30 then 'Young Adult'
when `Age`<50 then 'Middle Age'
... etc.
end as `Age Bucket`
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman1
Answers
-
You can do a seudo Datediff in Magic ETL
First Convert the date columns into decimal.
Then subtract.
Then convert to Days (multiply by 1 440 000).
When Dates are converted to decimal 1 equals 1 miliseconds (and for reference 0 is 1 Jan 1970)
0 -
This is definitely something that can be handled in a MySQL dataflow.
Select
*,
floor(datediff(curdate(),`Date_of_Birth`)/365) as `Age`
from data_table
then you can use the `Age` field to create your `Age Bucket` Field:
select
*,
case when `Age`<18 then 'Minor'
when `Age`<30 then 'Young Adult'
when `Age`<50 then 'Middle Age'
... etc.
end as `Age Bucket`
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman1
Categories
- All Categories
- 1.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 292 Workbench
- 4 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 95 SQL DataFlows
- 600 Datasets
- 2.1K Magic ETL
- 3.7K Visualize
- 2.4K Charting
- 685 Beast Mode
- 43 App Studio
- 38 Variables
- 655 Automate
- 170 Apps
- 438 APIs & Domo Developer
- 42 Workflows
- 5 DomoAI
- 32 Predict
- 12 Jupyter Workspaces
- 20 R & Python Tiles
- 383 Distribute
- 110 Domo Everywhere
- 267 Scheduled Reports
- 6 Software Integrations
- 111 Manage
- 108 Governance & Security
- 8 Domo University
- 25 Product Releases
- Community Forums
- 39 Getting Started
- 29 Community Member Introductions
- 98 Community Announcements
- Domo Community Gallery
- 4.8K Archive