# Bar chart of column Sum

Hey,
Insanely basic question but I just can’t get it to work.
I’m trying to create a bar chart of the sum of each column.
So the chart should just have two bars,

• FIRST bar of height 6
• SECOND bar of height 9
What am I missing?

Thanks!
Ian

Hi @Ian_T

not sure you can display a summarize information from table.
I suggest the following :

• Create a “total table”, with row “First”, and “second”
• in a formula column, i would write this using switchif() function to refer to different columns SwitchIf(thisRow.Name="First",[Ian_T Problem].First.Sum(),thisRow.Name="Second",[Ian_T Problem].Second.Sum())
• Draw total table

Configuring the table this way

Please let me know if I misunderstood yoir point
thanks !

Quentin

1 Like

Thats exactly what I mean @Quentin_Morel !
Thank you so much for taking the time.

It seems so strange that we can’ t do this directly in a chart. I think if Coda offered the “summarize” row, as the “Horizontal Axis” option in Chart Display.

1 Like

No problem @Ian_T !

There are indeed lots of suggestion to keep on improving CODA

To extend your formula @Quentin_Morel, without creating new rows:
Is there a way to sum (First x Second).
So for you data it would 20.
(1 x 2)+ (2 x 3) + (3 x 4) = 20

Not 6x9 (obviously).
Thanks,
Ian

Of course @Ian_T !

Just use the very famous Sumproduct()

3 Likes

Quentin_Morel You are a gentleman and a scholar!

1 Like

Ahah do not hesitate, I also learned from community !!

1 Like

Final question…I hope.
So the two columns I’m using in SumProduct() are of types Duration, and Number.
I can’t use toNumber() to convert type, as it expects a value, not a list. So how do I convert the whole columns type in the formula?

@Ian_T
you can totally make sumproduct() with duration * number.
If you dont want to, just create a column with DurationColumn.ToNumber(), and to the sumproduct() with this new column and the number one

Anyway, the results are the same :

1 Like

I’m getting an odd error.

Could be because the “Risk Factor” is generate by selecting High, Medium, Low, from another column.

Otherwise try to add .tonumber() after the reference of this column in your somproduct

Apparently you can only do .ToNumber() on a value, not a list.

Hi @Ian_T ,

for me it’s OK. When I see the little logo after the reference in the switchif() function, il wondering :. Does your risk factor column have a number format ?

1 Like

When I look at the column, it has a number format.

But when I look at the formula it says this:

Do you have something else in your doc that is called “'RISK FACTOR”. You can see the little two rectangles logo which is diufferent than the logo with “12”. May be you are referecing something else ?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.