Discussion Board for collaboration related to QlikView App Development.
This is the line which creates a calculated dimension for a straight table -
Aggr(Count(DISTINCT [From - To State Code]), [Carrier Name])
Carrier Name holds the names of commercial airline companies. From-To state refers to states in the USA.
How does qlikview process this line of script ? Can someone show this graphically ?
make a chart with
dimension Carrier Name
expression Count(DISTINCT [From - To State Code])
QlikView Technical Brief - AGGR.docx
This line just count of unique `From-To` for every Carrier.
If you set it in dimension you just get a numbers and corresponding them Expressions.
For Example you have a table:
Result table will be:
Means that Carrier 'qe' has 3 distinct from-to codes, `ee` has 2, and `de` has 1.
Graphically Carrier will be Dimension, count(distinct ...) will be Expression
Hope it helps.
That doc uses long examples. I found a small and much better one for just AGGR(). Easy read. I am not sure if the example is 100% correct -
I am trying to compare this to SQL (in SQL server). I did it like this (bus = carrier/flight, route = from-to) -
-- Get the number of routes (call it RouteCount)
-- for each bus. Then, find the number of
-- unique RouteCounts. Find how many buses
-- serve each of these RouteCounts
select Routes, COUNT(Bus) as NumOfBuses
select bus, COUNT(route) as Routes
group by bus
) as Q1
group by Routes
The result of the above query is equivalent to AGGR()
I think in your example the Qlik aggr "aggr(COUNT(route), bus)" is the inner query
then you use the aggr as a calculated dimension
dim aggr(COUNT(route), bus)
expr count(distinct bus)
source data at the left
aggr top r
result bottom r