# Sorting columns

Hi all,

I need help with sorting in my Analysis where I have both measures from my dataset, calculated measures and caluculated columns.

M1 = Helårs Person = Measure from dataset

M2 = Disp. Beløb = Measure from dataset

M3 = Gns. Pris = Calculated measure

M4 = Mdg. = Calculated measure

M5 = Pris = Calculated measure

M6 = Sam. = Calculated measure

It appears that I can only sort M1 to M4! How can that be?

Besides that I have some calculated columns ( C1 - C6 ) where I have a similar problem.

It is only possible to sort C1 and C4.

As You can se C1 and C4 headers are aligned to the right and C2,C3,C5,C6 headers are aligned to the left. Why is it like that and does that affect the possibility to sort the columns?

0

## Comments

Niels ThomsenHi John

Some calculations have relative references like:

sum(d-1, d1:0, m1)This formula will accumulate the numbers from the first row to the current.

When you have this kind of relative references, TARGIT disallows sorting - because you have a calculation that is based on the current sorting of data - and now you want to sort the table based on the result of that calculation - in a way it's like a circular reference.

However if you change the formula and add the u modifier like this: s

um(d-1, d1:0(u), m1)- you should be able to sort that type of calculation as well.The u-modifier means that the calculation should still refer to the unsorted sequence of data. So e.g. the accumulation syntax will still accumulate according to the original sorting of the data.

br/Niels

John JacobsenHi Niels

The syntax in the calculated columns is like this:

sum(d-1, 0, m4)

sum(d-1, 0, m5)

sum(d-1, 0, m6) etc.

and

avg(all, 0, m4)

avg(all, 0, m5)

avg(all, 0, m6)

When I try to make further calculations like:

sum(d-1, 0, m7)

sum(d-1, 0, m8)

avg(all, 0, m7)

avg(all, 0, m8)

the problem accours.

br/John

Niels ThomsenWe found at that one of the row references refered to d1 (and not 0) - after that the u parameter worked.

br/Niels

Please sign in to leave a comment.