DataFlow ETL to change column values based on values in another column
We recently discovered a data tracking issue that affects one of our datasets.
The result is that the Revenue values have become meaningless after 24th April 2018. The other columns of data are ok and are still required.
My aim is to change the all Revenue values to 0 when the date is greater than or equal to 24th April 2018.
I have been trying to do this in a DataFlow but have been unsuccessful so far.
I attach a screenshot of how the table is structured.
Any ideas of what to use in the flow would be much appreciated. Thanks
Comments
-
select
case when `Activity Date`>='2018-04-24' then 0 else `Revenue` end as `Calculated_Revenue`
If you wanted to save the field with the same name, then you could just end it with "end as `Revenue`" instead.
1 -
How would you do the same in magic ETL.
For instance if I need to coalesce one column to another only when value is in a pattern0 -
there isn't an equivalent of COALESCE or CASE in Magic 1.0.
You can use FILTER to create your CASE switches. Then use a second set of FILTERs on NULL and NOT NULL to define the COALESCE (which value you want to prefer to keep) then use APPEND to bring all the values together.
Be careful in defining your FILTERs. There is no ELSE equivalent, so carefully define an ELSE clause as the OPPOSITE of your FILTERs.
In the Magic 2.0 beta you can implement SQL / Beast Mode in a scripting tile which may make this story easier. Just be careful, b/c the Magic ETL does NOT create a SQL engine instead, the command gets interpolated into a JAVA (or similar) based implementation of the SQL function.
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"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
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive