Creating stacked bar chart from columns in data set

I would like to create a stacked bar chart that shows one stacked bar each for several columns in my data set, but not all of them. The number of different values contained within the columns would be the stacks. For example, say I have the attached dataset, then I want to make a chart similar to the one depicted in the other attached file.

Best Answers

  • Valiant
    Valiant 🔵
    Accepted Answer

    Ok so if you've got the dataset described and you're wanting to show 3 different column names along the X axis, then you'll need to modify your original dataset so that all 3 column names can be found within a single column of data. 

     

    Using a SQL transform you could do something like this:

    SELECT `col 1` AS 'Value', 'col 1' AS 'column_name'
    FROM dataset
    UNION ALL
    SELECT `col 2` AS 'Value', 'col 2' AS 'column_name'
    FROM dataset
    UNION ALL
    SELECT `col 3` AS 'Value', 'col 3' AS 'column_name'
    FROM dataset

    This would result in a Value column and a column_name column. With this new dataset, use column_name as your X axis. A COUNT of Value as your Y Axis and the Value column as-is for your Series.

     

    I believe that should get you what you need.

     

    Let me know if you have any questions,

    ValiantSpur

     

    **Please mark "Accept as Solution" if this post solves your problem
    **Say "Thanks" by clicking the "heart" in the post that helped you.

  • Godzilla
    Godzilla 🟢
    Accepted Answer

    Go to the Datacenter and on the top white strip, look for the Magic Transform section. Click on the SQL icon and select either MySQL or Redshift(i dont' think it matters). From the next page, click on the select the Input Dataset drop down and select the dataset you have created. Then click on Add Output dataset and write you're SQL in there. Don't forget to click on Additional Options and select when you want the dataflow to run. 

Answers

  • Thanks for replying ValiantSpur.

     

     

    This is very intuitive and makes sense to me. The only thing I'm unsure about is how to use this transform in Domo. Do I input it into beastmode or where do I code this in the interface? 

     

    Cheers,

    user03896

  • Thank you Godzilla! The transform worked.

This discussion has been closed.