Hi brains trust. I'm hoping someone can guide me here. Is it possible to use Dynamic Text in ArcGIS Pro to return the SUM of values in an attribute table (got this bit down pat) and then calculate/format a display value.
For example, I run the SUM function on the Shape_Area field and it returns metres squared but I want to display it as Hectares. In labeling scripts this would be done like this using VB script: formatnumber(Shape_Area\10000, 1).
Another calculation I'd like to do is take the SUM and multiple by 0.5 or 0.3 to get a percentage of the SUM.
An extension to this is, can separate values in dynamic text be added together to get a total (i.e. SUM A, plus SUM B = Total)?
No I hadn't, but it's not labels that I'm trying to create. I'm trying to create Dynamic Text in the Layout (i.e. A statistics summary in the legend area with Sums of different area values with calculations applied)
I am assuming you are using arcgis pro.
Are you summing multiple polygons at once?
have you looked here
Hi Rickey. Yep - using ArcGIS Pro 2.5. It is summing multiple polygons based on the Shape_Area field (m2). I was hoping to be able to calculate some features to be a percentage of the value in the Shape_Area field based on categories in a different field (i.e. Category = 30% would result in Shape_Area x 0.3 for that row only). I don't think it is quite there yet from what I can find. Might have to try using Model Builder to generate a statistics table or something in the layout.
Hi you might have figured something out but if not, I was wanting to do something similar, but instead to modify the dynamic text of a summed ShapeLength field in feet to show that sum in miles. I'm using Pro 2.8.3 and added a dynamic text for Sum. Once created get into the dynamic text Format Text window and modify the plain text after after the field="SHAPE_Length" portion of the dynamic text code and enter your conversion factor. Next click the Tag View for it to take. Here's mine:
Day Segment Sum: <dyn type="table" property="sum" mapFrame="Monday Frame Map Frame" mapMemberUri="CIMPATH=friday_small_frame_2/residential_routes_jw_6_fri_2.xml" field="SHAPE_Length * 0.00018939" decimalPlaces="2" separator="true"/> miles
Walla!
Hi @BrettGovernanti1 I've just seen your reply (posted the thread using the wrong account so didn't get notified. I just tried out your suggestion and it works well. Can't remember what the original use case-problem was but this definitely works well.
Funnily enough though, when setting up the little test I did, the SUM dynamic text element was very unpredictable. When setting it to Visible rows, it would show the total of all rows still, but as soon as I added in the /1000 to convert to Kilometres, it would show the correct visible only figure. Tried a number of ways to get it to show what it should depending on the settings, but only the modified version of the text returned an accurate result.
@BrettGovernanti1 - your workflow worked perfectly! That should be marked as the solution to the original post.
@LindsayRaabe_FPCWA - strange occurrence you were having. One of my workflows for layouts uses a definition query on the necessary layer and then the All Rows option shows what I need. Maybe that would help in your situation?
Quite possibly that would work for us. We have similar workflows in a number of map templates anyway that do require a definition query, so All Rows would work the same as Visible Rows.
Your suggestion to tap into the dynamic text Text View and add calculations worked perfectly for one of my problems! Wondering if it is possible to produce the sum of multiple values using either SQL or the Text View and display it in my map layout. I would like to calculate the total drive length of a series of route that I have created. In order to do this, I need to query all of the roads in each route and then multiply the road lengths by the number of lanes present. (i.e. select roads with 2 lanes and multiply by 2, select roads with 3 lanes and multiply by 3 then produce a grand total of the length of road driven for each route)