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

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.

0 4 714
4 REPLIES 4

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

@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?

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.

+Steve Coile Thank you very much! It worked!

Top Labels in this Space