Load script
Load the following data as an inline load in the data load editor to create the chart expression examples below.
Temp:
LOAD * inline [
Region|SubRegion|RowNo()|NoOfRows()
Africa|Eastern
Africa|Western
Americas|Central
Americas|Northern
Asia|Eastern
Europe|Eastern
Europe|Northern
Europe|Western
Oceania|Australia
] (delimiter is '|');
For more information about using inline loads, see Using inline loads to load data.
Chart expression
Create a table visualization in a Qlik Sense sheet with Region and SubRegion as dimensions. Add RowNo( ), NoOfRows(), and NoOfRows(Total) as measures.
Result
Region |
SubRegion |
RowNo() |
NoOfRows() |
NoOfRows(Total) |
Africa |
Eastern |
1 |
2 |
9 |
Africa |
Western |
2 |
2 |
9 |
Americas |
Central |
1 |
2 |
9 |
Americas |
Northern |
2 |
2 |
9 |
Asia |
Eastern |
1 |
1 |
9 |
Europe |
Eastern |
1 |
3 |
9 |
Europe |
Northern |
2 |
3 |
9 |
Eurrope |
Western |
3 |
3 |
9 |
Oceania |
Australia |
1 |
1 |
9 |
Explanation
In this example, the sort order is by the first dimension Region. As a result, each column segment is made up of a group of regions that has the same value, for example, Africa.
The RowNo() column shows the row numbers for each column segment, for example, there are two rows for the Africa region. The row numbering then begins at 1 again for the next column segment, which is Americas.
The NoOfRows() column counts the number of rows in each column segment, for example, Europe has three rows in the column segment.
The NoOfRows(Total) column disregards the dimensions because of the TOTAL argument for NoOfRows() and counts the rows in the table.
If the table was sorted on the second dimension, SubRegion, the column segments would be based on that dimension so the row numbering would change for each SubRegion.
For more information about expressions, see Using expressions in visualizations.