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

  • ST_Superman
    ST_Superman Domo Employee

    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.

  • 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 pattern

  • 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"