Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Federicofkt
Contributor III
Contributor III

Replicate the behaviour of table Total with FirstSortValue

Hi,

I have a measure in a table with the FirstOrderValue.

I've set the total function to sum, and it works fine.

 

Now I'm setting another table with only the sum of some measure, included the one discussed above, but when I try to do something like this: sum(Aggr(FirstSortedValue(operative_agreed, -period_date), intermediary)) the result differs (by a lot) with the total in the other table, where the measure is FirstSortedValue(operative_agreed, -period_date).

intermediary here is the first dimension I used in the other table.

 

What's the issue here?

Thanks

 

Labels (2)
1 Reply
F_B
Specialist
Specialist

Hi @Federicofkt ,

you should ensure the aggregation context in both tables matches as closely as possible.

FirstSortedValue() can return NULL if there are multiple values that are equally the "first" due to the sorting criteria. This can lead to inconsistencies in the aggregation process.

In the sum(Aggr(...)) calculation, NULL values can affect the summation, leading to results that diverge from the direct total in your other table.

 

Hope this helps