Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Adding RowNo(Total) displaying wrong results in Straight Table

Hi All,

I have added function RowNo(Total) in straight table as expression. However when I add this expression the result of table are wrong.

Fyi info i have around 5 dimension and 5 expression excluding RowNo(total).

Thanks for your help!

2 Replies
awhitfield
Partner - Champion
Partner - Champion

Hi areeys,

have you checked this out:

RowNo - chart function

RowNo() returns the number of the current row within the current column segment in a table. For bitmap charts, RowNo() returns the number of the current row within the chart's straight table equivalent.

If the table or table equivalent has multiple vertical dimensions, the current column segment will include only rows with the same values as the current row in all dimension columns, except for the column showing the last dimension in the inter-field sort order.

Syntax:

RowNo([TOTAL])  

Return data type: integer

Arguments:

ArgumentDescription
TOTAL  

If the table is one-dimensional or if the qualifier TOTAL is used as argument, the current column segment is always equal to the entire column.

The TOTAL qualifier may be followed by a list of one or more field names within angle brackets <fld>. These field names should be a subset of the chart dimension variables.

See: Defining the aggregation scope  

Examples and results:

CustomerUnitSalesRow in SegmentRow Number
Astrida411
Astrida1022
Astrida933
Betacab514
Betacab225
Betacab2536
Canutility817
Canutility 28
Divadip419
Divadip1210
ExamplesResults
  Create a chart consisting of a table with the dimensions Customer, UnitSales, and add  RowNo( ) and RowNo(TOTAL) as measures labeled Row in Segment and Row Number

The Row in Segment column shows the results 1,2,3 for the column segment containing the values of UnitSales for customer Astrida. The row numbering then begins at 1 again for the next column segment, which is Betacab.

The Row Number column disregards the dimensions can be used to count the rows in the table.

  Add the exression:

IF( RowNo( )=1, 0, UnitSales / Above( UnitSales ))

as a measure. 

This expression returns 0 for the first row in each column segment, so the column will show:

0, 2.25, 1.1111111, 0, 2.5, 5, 0, NULL, 0, and 4.

Data used in examples:  

Temp:

LOAD * inline [

Customer|Product|OrderNumber|UnitSales|UnitPrice

Astrida|AA|1|4|16

Astrida|AA|7|10|15

Astrida|BB|4|9|9

Betacab|CC|6|5|10

Betacab|AA|5|2|20

Betacab|BB|1|25| 25

Canutility|AA|3|8|15

Canutility|CC|||19

Divadip|CC|2|4|16

Divadip|DD|3|1|25

] (delimiter is '|');

Andy

Not applicable
Author

Hi Andrew,

I have tried but it still display the wrong result of the table.