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.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 621 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 743 Beast Mode
- 58 App Studio
- 41 Variables
- 686 Automate
- 176 Apps
- 453 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 395 Distribute
- 113 Domo Everywhere
- 276 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive