Using calculations from the visuals

Hello! I need help with taking the calculated frequency from two histogram plots (that are filtered differently) to make a new histogram dividing them. I am trying to achieve a failed count divided by a total count in each bin. I have them currently using the same binning scheme (the same start point and width). Or if anyone knows what quicksight calculation the histogram uses is, so that I could put it into a calculated field that would be helpful.
Thanks!

Hi @anyssabc and welcome to the QuickSight community!
To my understanding, histograms normally provide a count of your field and then place them in buckets depending on the step count you choose. It sounds like by your scenario that you’re trying to achieve a ‘failed count’ over ‘total count’, so I would suggest looking in to the countOver function as that allows you to aggregate and account for the various filters.

Let me know if this works for your case or if you have any additional questions

Thanks Brett! This is really close to what I’m looking for :slight_smile: Could you please explain if building dynamic (as in change according to datasets max and min values) buckets is something I should be able to do within the countOver function or is that something I have to do separately? I am trying to make a histogram within the clustered bar combo chart, so there is no automatic grouping I am aware of.

Hi @anyssabc,
You would create a separate calculated field for the buckets, if you’re looking to try and recreate in a combo bar chart, you’ll need a separate field to use in your x-axis that is for the buckets (and then your count field will be your y-axis).
You can build out buckets with an ifelse statement, I’m not sure the fields you’re currently using but it may look something along the lines of:

ifelse(
{CountField} > 0 AND {CountField} < 6, 'Bucket 0-5',
{CountField} > 5 AND {CountField} < 11, 'Bucket 6-10',
....,
....,
NULL)

Let me know if you have any additional questions or if this works for your case.

I think I understand what you mean, that I have to make a set of ranges within a calculated field, but I’m having trouble applying your solution to what I have currently. I don’t know how to make the number of sets dynamic so that they reflect my number of histogram bins parameter. I have a calculated bucket width based on the bucket number parameter, but am struggling to use it to make a set of ranges like you show.

ifelse(

{CountField} > min({float_value}) AND {CountField} < (min({float_value})+{bucket_width}*range(${buckets})[0]), ‘Bucket 1’,

{CountField} > min({float_value}) AND {CountField} < (min({float_value})+{bucket_width}*range(${buckets})[1]), ‘Bucket 2’,

NULL)

am I on the right track to making the buckets? Please let me know if you have any more advice!

Hi @anyssabc,
I’m not quite sure what you mean by making the number of sets dynamic so that they reflect the number of histogram bins parameter. As there’s a bit more to this question, it may be easier to assist further if you’re able to upload a copy of sample data to the Arena view so that I can test out some scenarios for this case.

Hi Brett,

Yes sorry it is a bit weird what I am trying to accomplish. To reiterate, I’m trying to make it to where I can have an adjustable histogram (where you can adjust the number of bins with a parameter), and it adapts to the range of the dataset, within the ‘cluster bar combo chart’. I am doing this so I can get a count of the parts that match a given parameter within a bin range as the bar chart, then the rate at which the bin matches the parameter would be the line graph.
I put a sample dataset and I tried to start it here; thanks so much again!
cluster_bar_combo_histogram

Hi @anyssabc,
Thank you for the additional clarification, one point of note though from your most recent comment; unfortunately parameters can not be used to adjust the bin count directly. When not using a histogram, the number of ‘bins’ would need to be defined in a calc. field, as bar charts do not allow the same type of functionality as a histogram. Your bar chart is going to split up your data however it’s set to aggregate (there’s no option to limit the number of columns or bins).

One work around you could explore for different bin counts; you could create a separate visual for each bin count that you’d like to have setup, then you can assign rules to hide/show each visual based on a parameter (which could be your bin count param).

Apologies for any confusion, I was working off the thought you had mentioned in your original message that you wanted to formulate a total count and a failed count for each ‘bin’ and those bins were pre-defined.

Hi Brett,
Gotcha; thanks for explaining it to me and for the help!