What would you like to know more about?

Write Your Own Questions

Once you understand the SQL behind a question, you can create one!

  • Make sure you understand Transact-SQL (T-SQL), which is different from the SQL-like conventions in MinistryPlatform.
  • Make sure you have access to the database server.
  1. Go to Ministry Answers > Ministry Questions.
    If you don't see this in your menu, reach out to Professional Services to get Ministry Answers installed on your system.
  2. Click New Question at the top.
  3. In the General section, add the necessary information.
    1. Select the Accounting Company. Note that answers do not use the value in this field. You will still get all the data you ask for.
    2. Select the Ministry that "owns" the question. This does not have to be related to the Ministry_ID in the question.
    3. For Question Title, enter a short summary of your question. For example, "Total People Baptized".
    4. For Question Header, enter text to use as a header on summary views. For example, "Baptisms".
    5. For Question Description, enter a description of what you are asking. For example, "Count of all the people who received Milestone_ID = 2 (Baptism) during the Ministry Week".
    6. If needed, you can add Planning Notes to track any information you need to know in order to create the question. This is helpful when you engage Professional Services to implement the SQL to answer your question.
    7. Discontinued should be set to No. In the future, you can set it to Yes if a question is no longer needed.
  4. In the Settings to Automate Answers section, add the necessary information.
    1. For Answer SELECT, enter the T-SQL to generate your answer. (See Understanding the T-SQL for details.)
    2. Set Automation Active to Yes. This way, the question will be answered when the stored procedure runs at night.
    3. Select the Answer Format (either numeric or currency output) that makes sense based on your question.
    4. For Answer Starts After, select the date to begin collecting data. If you're gathering data related to a certain campaign, you might use the campaign start date.
    5. For Answer Order, enter a number to represent the order in which questions will be answered. For example, if a question (Question B) relies on answers from another (Question A), you can set the order for the dependent question (B) to be greater than the order for the independent question (A). This way, the answers are available to B when it's calculated.
    6. For Weeks to Update, enter the number of weeks you want the system to look back and continue updating the data for a particular ministry week before it's finalized. For example, you hold a new member class and ask people to return a membership agreement at their convenience. Those will trickle in over the next few weeks. To tie them to that membership event, you want the system to go back and update the total for the membership question for a few weeks to ensure everyone is counted for that ministry week.
  5. In the Summary Page Settings section, add the necessary information.
    1. If the question will be on the Congregation, Ministry, and/or Program Summary pages, set the relevant fields to Yes. This is a way to filter data to where it fits best.
    2. For Value Aggregation, enter the standard SQL option you want to use to aggregate values. Typically, you'll want to use SUM so it can add up the values for all weekly data in monthly or annual reporting. However, if you want reports showing peak attendance in each month/year, you might use MAX.
  6. Click Save.

Your question displays in the list of Ministry Questions.

Discontinue a Question

If a question is no longer relevant to your ministry needs, we recommend discontinuing it rather than deleting the question record. This way, you can keep all the historical data in case it becomes relevant again in the future. To do this, edit the question record, and set Discontinued to "Yes".

Update Your Data

A stored procedure runs every night to calculate the answers to your questions. But if you need to test a question you've written, you don't have to wait. You can manually run the stored procedure from Management Studio. This regenerates answers to all existing questions, going back the number of weeks specified. For new questions, the procedure recognizes that there is no data, so it will start from the Answer Starts After date and generate weekly data from then until now.

To run the stored procedure, use this call:

EXEC dbo.service_ministry_QA_insert_answers 1

Want to see some cool SQL stuff? You can look at (but do not change) any of the service_ministry_QA_ stored procedures.