Changing a Column from Measure to Dimension

Hello all,

 

I am seeing if there is a way I can convert a column named 'isActive' from a measure to a dimension. Currently the values show as '0' or '1' as a measure, but I want this column to be under the dimension field and display as 'True' or 'False.'

 

I am trying to avoid a beast mode calculation because the dataset the cards are built from is used across many different cards and it will be very inefficient to add the beast mode calculation to the existing and also new cards. 

 

Any suggestions will be appreciated!

Comments

  • GrantSmith
    GrantSmith Indiana 🔴

    Hi @SLam 

     

    You can use a beast mode with a case statement to solve you problem.

     

    CASE WHEN `isActive` = 1 THEN 'True' ELSE 'False' END

    The above is assuming that You only have values of 0 and 1 (anything other than 1 is considered False)

     

    If you want to be alerterd if you get a value other than 0 and 1 you could do something like:

    CASE WHEN `isActive` = 1 THEN 'True'
    WHEN `isActive` = 0 THEN 'False'
    ELSE 'ERROR' END

     

    You said you didn't want to utilize a beast mode because you'd have to do it reimplement it on every card that uses that dataset however you can select the checkbox on the BeastMode that says Share Calculation on Dataset and it will then be available to ALL cards which utilize that dataset so you don't have to re-implement it, just change the field it's displaying.

  • GrantSmith
    GrantSmith Indiana 🔴

    @SLam 

     

    If this is already a part of a magic ETL data flow you could use a value Mapper tile to convert that column to textual representations by overwriting the original value.

     

    It should look something like this (make sure you select your isActive field is selected for "Select a column to search")

    Screen Shot 2020-06-05 at 6.55.09 PM.png

  • Thank you so much for your input on this.

     

    Another question I had:

    The dataset the card is pulling from is a DataFusion. Is it possible to edit the column's data type from the DataFusion level?

  • jaeW_at_Onyx
    jaeW_at_Onyx Budapest / Portland, OR 🟤

    https://www.youtube.com/watch?v=9HYx1vn3HRM

     

    It's a little bit of work, but you can alter the schema of your Fusion using the JavaCLI.  Here's a link to a tutorial where i rename a column but you can also change the data type.

  • Hello @jaeW_at_Onyx 

     

    Thank you for that video. The JavaCLI looks a bit too much.

     

    Is there no other way to change the data type via the Edit Fusion UI on Domo? Would the only other way be to rebuild the fusion?

  • jaeW_at_Onyx
    jaeW_at_Onyx Budapest / Portland, OR 🟤

    Even if you rebuild the fusion, in the Domo UI there is no way to change the data type.

     

    There is a new data views beta that will give you more control over editing the schema of views.  Ask your CSM for details.  

     

    You'll have to move all your cards to the new dataset though.  

  • Hello @jaeW_at_Onyx 

     

    Could you verify if a  value Mapper tile could fix this as well? This was mentioned in one of the replies above.

  • jaeW_at_Onyx
    jaeW_at_Onyx Budapest / Portland, OR 🟤

    !!! 

    haha, you initially said you wanted to alter a fusion. Of course you can fix a data type in ETL.  You can use any ETL engine, MySQL, Magic or Redshift to change data types.

     

    In Magic you should use Set Column Type IF the data can be coerced to the new data type.  Value mapper is most appropriate if you need to change the values in the column first.

This discussion has been closed.