Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
dcd123456
Creator
Creator

First Function() in a table graph

Hello

i have a date table like this

   

Idusuariotxt
12usr1prueba1
534usr2prueba1
34usr3prueba1
3usr4prueba3
26usr5prueba2

i have created a table graph with the field Txt like dimension field, and a expresion to count the diferents txt fileds Count(distint Id), but

also i want to see in each row of the table the first value of the field id and usuario, i try the expresion first(id) but it don't return anything.

Somebody know how to show ony the first value of this field (id) for each each row.???

i have attached and excample

thanks in advance for your help

best regards

dcd

18 Replies
sunny_talwar

If we are adding a RecNo() or RowNo(), we can definitely use what you proposed or change my expression to this:

SubField(Concat(DISTINCT usuario, '|', Key), '|', 1)

Aggr() function sorts the data by load order and that is why I proposed its use. But Not sure why it isn't working with Concat. I will have to do further investigation into that or may be swuehl‌ can help as he was the one who explained that Aggr() uses load order.

Best,

Sunny

tamilarasu
Champion
Champion

I don't think the problem is caused by Aggr function. Even the above expression, produces the same result.

Capture.PNG

sunny_talwar

Aggr is not a problem here, I was thinking more of a solution. Check this thread I just created -> Load order in Concat() function

sunny_talwar

Here you go:

SubField(Concat(DISTINCT usuario, '|', Aggr(RowNo(), txt, usuario)), '|', 1)

SubField(Concat(DISTINCT Id, '|', Aggr(RowNo(), txt, usuario)), '|', 1)

Capture.PNG

But I guess this solution is good for someone trying to do this on the front end. If we can alter the script slightly, I would  definitely do RecNo() or RowNo() in the script.

Best,

Sunny

swuehl
MVP
MVP

If for example the same usuario value appears for more than one txt, the suggested solution might still fail.

(for example, add these two lines to the excel file:

99usr1prueba5
11usr2prueba5

)

There is a difference between field load order and record load order.

If there are only distinct values in field usuario and / or  Id, the solution with aggr() should work, if you are chosing the right fields in the aggr() dimension.

In other words, to make it work, I think you need to identify some kind of primary key field in your table (maybe Id?)

sunny_talwar

So we still might need a unique id to for Aggr() function based on the dataset? That make sense. Thanks for chipping in and helping Stefan. Like always, your advice is always much appreciated.

tamilarasu
Champion
Champion

Yes, we need some key field to identify the load order. That is the reason I suggested to modify the load script (RecNo or FirstValue syntax) else I would have suggested some expression (as he was not clearly mentioned his requirement. I thought he wants to show first value (he mentioned in subject line as first value) from the excel). RecNo() (Not Rowno()) works fine in the above cases. Anyways, he is happy with your solution.

sunny_talwar

Since we don't have a preceding load in the example, I don't see how is RecNo is different from RowNo() here?

Capture.PNG

And Finally you won the battle my Friend. Just to clarify, I never doubted what you proposed, I was just trying to provide a front end solution.

tamilarasu
Champion
Champion

  I have no idea about the front end solution in this particular case. So,I was interested to know, if there is any. Just now noticed, by mistake I have entered a wrong comment (It should be OR )

Cheers

m0703.gif