Hi All, I've noted that in charts - Histogra...

(Malaka Jayawardene) #1

Hi All,

I’ve noted that in charts - Histogram, only one colour is applied to all the bars. Is there a way to apply different colours to different bars on it?

Thanks.

(Aleksi Alkio) #2

When values are coming from the same column, you can use only one color.

(Malaka Jayawardene) #3

@Aleksi_Alkio Thank you. If I wanted responses from a single column to be displayed in multiple colours, I guess, I have to get those responses broken down in to different virtual columns isn’t it? For example, I have a ‘physical’ column of Enum type called “Type of liver resection”, and its options for the user are “Trisectionectomy”, “Hemi hepatectomy”, “Sectionectomy”, “Segmentectomy”, “Non-anatomical resection”. For each row in the spreadsheet (=each patient), user can select only one. So the gSheet’s “Type of liver resection” column shows 3 trisectionectomies, 4 hemi hepatectomies, 2 sectionectomies, 9 segmentectomies, 10 non-anatomical resections so far recorded. What I want is to create a chart that shows these values with different colours. So I created a virtual column for each of these, as in, if the “Type of liver resection” = “trisectionectomy”, the number type VC [Trisectionectomy_Count] would record ‘1’ value in it. So I thought I could eventually write a SUM expression to calculate the ‘Trisectionectomy_Count’. So for the 5 different responses I created 5 virtual columns to record a value of ‘1’ everytime a user selects the relevant option. And then I created 5 more virtual columns to SUM each of them. But the SUM(LIST([Trisectionectomy_Count])) didn’t return the SUM of Trisectionectomies. All it does is, return a value of 1 only if I select ‘Trisectionectomy’ as the option, as if it’s not summing up all the 1’s in the virtual column [Trisectionectomy_Count]. Could you help me out?

(Steven Coile) #4

The reason SUM(LIST([Trisectionectomy_Count])) doesn’t work is because [Trisectionectomy_Count] refers to the Trisectionectomy_Count column value of the current row only. You then put that one value into a list and summed the single value in the list.

To get a list consisting all of a column’s values, include the table name in front of the column reference, as in: Patient Info[Trisectionectomy_Count]. Because this produces a list, you don’t need to (and in fact should not) wrap it with LIST(). It can go directly into SUM():

SUM(Patient Info[Trisectionectomy_Count])

This will return the sum of all values in the Trisectionectomy_Count column of the Patient Info table.

(Malaka Jayawardene) #5

+Steve Coile Thank you very much! It worked! :slight_smile: