15 juni 2022 Aggregating data in Qlik Sense with the Aggr() function Deel dit bericht Every Friday at Bitmetric we’re posting a new Qlik certification practice question to our LinkedIn company page. Last Friday we asked the following Qlik Data Architect certification practice question about aggregations in Qlik Sense with the Aggr() function: The correct answer is C: Avg(Aggr(Sum(NumberOfProducts * ProductPrice), OrderID)) To explain the answer let’s see what it is that is exactly wanted. We have a straight table with an order overview, in which we can see the PartnerID, how many orders they have placed, the lowest order value and the highest order value. Now the request is to add the average order value to this as well. Going trough the possible answers we can see that while answer A will work for the first four partners, it will quickly run into troubles calculating the average if there are more then two orders. And this is where the Aggr() function comes into play. To properly use the Aggr() function we need to have a look at the data model from which we can determine that the Fact table will look like this: So even without knowing the true contents of the table in this question, we can get an idea of the contents and what to do next. To be able to calculate the average order value per PartnerID, we need to calculate the total value of each OrderID first. This is done by multiplying the NumberOfProducts and the ProductPrice. Then if we total those values per OrderID we know what the total value of each OrderID is. To finalize we can then get the average of all these OrderID totals. And this is exactly what Avg(Aggr(Sum(NumberOfProducts * ProductPrice), OrderID)) does. The Aggr() function syntax is: Aggr({SetExpression}[DISTINCT] [NODISTINCT ] expr, StructuredParameter{, StructuredParameter}) So you will aggregate an expression, based on a StructuredParameter. The StructuredParameter is the dimension on which you would like to aggregate the expression. In our current example this is OrderID. To brake it down: We first calculate the value of the products: Then calculate the aggregated value of the products per OrderID: This basically creates an in memory table containing each OrderID and the total value of the OrderID. And now we can finally use the average function to calculate the average over the OrderID’s: Some other things to keep in mind: It is possible to aggregate on more then one dimension. And it is also possible to sort these. So if you use MonthYear as dimension for example, it is possible to sort these ascending or descending however it is needed. As seen in the Syntax, Aggr() can also use set expressions. So for example: {<Year = {2022}>} can be added to the Aggr() function. The standard calculation of the Aggr() syntax is a distinct aggregation. So for each distinct value of the dimension you would like to aggregate on, it will give the result. However if you have a repeating value in the dimension you can add NODISTINCT to the function. That’s it for this week. See you next Friday? More from the Bitmetric team Bitmetric Qlik Support Keep your Qlik environment running smoothly with proactive support that prevents issues before they appear. Available on flexible monthly plans. Learn more. Qlik vs Power BI Series See how Qlik and Power BI perform when theory meets reality. Three apps rebuilt, every step examined. Learn more. Qlik examentraining Functies Performance Oplossing Hoe kunnen we je ondersteunen? Barry beschikt over meer dan 20 jaar ervaring als architect, developer, trainer en auteur op het gebied van Data & Analytics. Hij is bereid om je te helpen met al je vragen. Bel ons Mail ons 29 november 2026 Power BI en Microsoft Fabric update november 2026: Fabric Apps, Copilot en het einde van R-visuals Fabric Apps is algemeen beschikbaar, Copilot gaat op 8 december standaard aan en R- en Python-visuals stoppen in mei 2027. We bespraken de november-updates van Power BI en Microsoft Fabric met onze consultants: wat het betekent, waar je op moet letten en ons advies. Data Governance Microsoft Fabric Nieuwe release Power BI Semantic Layer 29 november 2026 Qlik Cloud Update november 2026: Qlik Answers, MCP en het fundament eronder Qlik Answers kreeg custom skills en MCP is in één stap aan te zetten. Maar november bracht ook deadlines voor TLS, OAuth en gateways. Onze Qlik-consultants bespreken wat er nieuw is en waar je op moet letten. Nieuwe release Qlik 26 november 2026 Qlik DataTransfer stopt: data-integratie hoeft niet ingewikkeld te zijn Qlik DataTransfer stopt, maar dat betekent niet dat je een nieuwe data-integratietool nodig hebt. Aan de hand van een praktijkvoorbeeld laten we zien hoe je met PowerShell, Qlik CLI en Healthchecks.io een betrouwbare, onderhoudsarme data-integratie realiseert. Ook bespreken we hoe DuckDB en Parquet kunnen helpen om het capaciteitsverbruik in Qlik Cloud te beperken. Data-integratie Qlik
29 november 2026 Power BI en Microsoft Fabric update november 2026: Fabric Apps, Copilot en het einde van R-visuals Fabric Apps is algemeen beschikbaar, Copilot gaat op 8 december standaard aan en R- en Python-visuals stoppen in mei 2027. We bespraken de november-updates van Power BI en Microsoft Fabric met onze consultants: wat het betekent, waar je op moet letten en ons advies. Data Governance Microsoft Fabric Nieuwe release Power BI Semantic Layer
29 november 2026 Qlik Cloud Update november 2026: Qlik Answers, MCP en het fundament eronder Qlik Answers kreeg custom skills en MCP is in één stap aan te zetten. Maar november bracht ook deadlines voor TLS, OAuth en gateways. Onze Qlik-consultants bespreken wat er nieuw is en waar je op moet letten. Nieuwe release Qlik
26 november 2026 Qlik DataTransfer stopt: data-integratie hoeft niet ingewikkeld te zijn Qlik DataTransfer stopt, maar dat betekent niet dat je een nieuwe data-integratietool nodig hebt. Aan de hand van een praktijkvoorbeeld laten we zien hoe je met PowerShell, Qlik CLI en Healthchecks.io een betrouwbare, onderhoudsarme data-integratie realiseert. Ook bespreken we hoe DuckDB en Parquet kunnen helpen om het capaciteitsverbruik in Qlik Cloud te beperken. Data-integratie Qlik