How do I calculate multiple survey answers to display in operations dashboard?

1628
7
12-28-2018 01:48 PM
RandallMathews
New Contributor

Hello,

I have been trying to configure a dashboard that calculates total cost of multiple projects inputted via Survey123. Projects are broken down in multiple categories. I can get each category to provide a sum for that category, however I cannot figure out how to display the total cost. I have tried putting a calculation field, but I don't think the formula is correct.

Survey123

Here is a portion of the dashboard:

dashboard

How would I configure a widget to give me the sum of category c, d and g?

0 Kudos
7 Replies
StephenM
Occasional Contributor II

I don't think there's a way to do calculations within Operations Dashboard. There are a couple ideas related to this:

Arcade Expressions in Operation Dashboard

Arcade Expression in Ops Dashboard List Widget

You could calculate the value within Survey123. If you're just looking to sum three values, the formula you want would be something like this:

${cat_c_project_cost} + ${cat_d_project_cost} + ${cat_g_project_cost}

The sum() function is used to calculate the sum of the responses to a question that uses repeats.

RandallMathews
New Contributor

My thought was to calculate it within Survey123. That's what the all_cat_project_cost on lin 145 is. The formula within Survey123 appears to work. However, when I try to get the data to appear in the Dashboard, I can see there are four entries (my test entries) but it will not give me the sum of the values... merely the sum of the number of entries.

Count is the only way to display data.. every other option shows "no data"

By selecting the feature button, again I can see four entries but they state no value.

How can I configure this properly?

0 Kudos
StephenM
Occasional Contributor II

For number fields in your survey, you should be able to display the sum in an indicator element by selecting Sum as the statistic and choosing the target field.

sum in indicator example

0 Kudos
RandallMathews
New Contributor

This leads me to believe there is an issue with the calculation somehow. When I select the field, it will state "no data." However, I can see that there is data if I switch it to a specific project category.

0 Kudos
StephenM
Occasional Contributor II

It does seem like the values aren't being calculated correctly. Can you see the calculated values if you click "Show data table"?

0 Kudos
RandallMathews
New Contributor

You are correct, things aren't being calculated correctly. I see costs for different project areas, however the calculation portion is empty.

Is there something wrong with my calculation within Survey123 on line 145?

0 Kudos
StephenM
Occasional Contributor II

The calculation looks good. I think the issue is that the calculation doesn't like null values. If you set a default for the category fields it should work.

No defaults:

table example showing calculations with null values

With 0 as default:

table example showing calculations with defaults set

You might also run into an issue with the filter you have applied on the indicators, since you have them set to only sum the field in records where all_cat_project_cost is null.

0 Kudos