I have a named query I’m running and it’s interpreting some data from my database (mostly totals). I’m trying to calculate a percentage based off of those totals and I haven’t been able to do it in the query itself. Is there a way I can calculate this percentage using scripting and have it show up in my report? If so, how do I reference my query data? I want to calculate a percentage of Good Parts to Total Parts.
@KathyApplebaum Thank you for your answer. I’m wondering if you could maybe share an example of how I reference a specific column or row of data from the query? I’m new to programming and sometimes struggle with the proper syntax.
Also, my script doesn’t show up as a data source in the report. (I can’t insert my script as a data source in a text box)
That worked Perfectly! Thank you @paul-griffith and @Paul.Scott! It might be something worth adding to the Ignition manual that the Keychain functions are implemented in the design tab of the Reporting Module.
Can you not calculate a percentage of a column value based off its own total?
I keep getting <N/A> results in preview mode when trying to do the following:
I would like to have the % column show the percent of each row relative to the total.
so for that last row, the value of 7 would correspond to 50% in the second column.
Couldn’t get it working with the inbuilt total.Count property. But i did get it working by creating a new data source which is just manually calculating the total count from the PT_Reasons query source: