Modifying a Query Based on a Universe

Objective

After completing this lesson, you will be able to explain why modifying a query enhances data accuracy and relevance in a Web Intelligence document.

Edit a Query

You may need to change a query for several reasons:

  • To meet new business requirements by adding dimensions or metrics.
  • To improve performance by adding query filters to reduce the volume of data.
  • To create formulas or variables by adding new measures.

To modify a query, you select Edit in the Query section of the toolbar.

Edit query by selecting objects such as Year, State, and Sales revenue, then click the Run button to execute the query.

You select the object and place it in the table.

A dashed arrow points from the Query 1 panel with State, Year, and Sales revenue fields to a report table listing Sales revenue by State and Year.

The Two Levels of Aggregation: Database vs. Web Intelligence

In Web Intelligence, you work with two levels of aggregation. Aggregation means summarizing data, for example, by calculating a sum or a count. When you understand these levels, you can build efficient and flexible documents.

A user query flows from Web Intelligence Web Client to SAP BI Platform Processing Server, which retrieves and aggregates data from the Data Source, then returns results.
  • Aggregation at the data source level is the first and most important step. It takes place before the data reaches your Web Intelligence document. When you run a query, the Web Intelligence Processing Server creates SQL code and sends it to the source database, such as Oracle, SQL Server, or SAP HANA. This SQL code often includes aggregation functions such as Sum, Count, Avg, Max, and Min. The database engine runs the query, performs the calculations, and returns only the summarized results.
  • Aggregation at the Web Intelligence document level happens after the data is retrieved from the database and loaded into the Web Intelligence document’s microcube. For example, if your query includes sales revenue by country and year, you can perform further analysis:
    • You can create a table with the country dimension and the sales revenue measure. Web Intelligence sums the sales revenue for all years to give you a total for each country.
    • You can calculate total sales revenue using a simple formula, such as =Sum([Sales revenue]), in a free-standing cell. Web Intelligence adds all the sales revenue figures in the microcube.
    • You can change the context of your table. If your table shows year and sales revenue, and you add country, Web Intelligence updates the data to show country, year, and sales revenue.

Let's Summarize What You've Learned

  • Modify queries to meet new business requirements, improve performance, or create formulas or variables.
  • Aggregation occurs at two levels: first in the database, then in the Web Intelligence document.
  • Database-level aggregation summarizes data before it reaches Web Intelligence, improving efficiency.
  • Web Intelligence document-level aggregation allows further analysis and flexible data summarization after data retrieval.

Edit a Query Based on a Universe

Business Example

Your manager asks you to analyze quarterly sales performance, focusing on profit margins. You need to enhance the existing sales report by incorporating these new metrics to provide a comprehensive view.