Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm trying to create an expression with SET.
It is easy to do this...
sum ( {$<....>} a) - sum ( {$<....>} b)
BUT... how do i do it when i want it to be SUM (a - b), applying the same set analyis for both a and b?
Thanks,
sum ( {$<....>} a-b)
or
sum ( {$<....>} RangeSum(a, -b))
i can't do that. because the SET criteria for a and b are different....
I thought you said its the same.
Ok, use Only({$...} a) - Only({$...} b)
yes.. my bad.. typed too quick..
so, perfect, it works...
now, as i'm doing this in pivot table...
the subtotal wont work anymore.. it disappear...
any tips?
and also.. how does ONLY() works?
i tried to look up in the document, it's not very helpful...
the reason why the total is not working.. because...
instead of doin sum (only(a) - only(b)),
i remove the sum, otherwise the figures wont show...
thats why i asked how does only() works...
it's weird...
All answers depends on your data structure. You can reduce your file and post it or try to give more info.
About Only():
Originally this function checks if your field values are all the same and return this value or null.
But when you know that there is only one value (for your case it was my suggesstion 'cause you use and without aggregation) you can use it to modify the set (of dimension values) of such fields.
upd:
Oh, I've just realised.
I think when you do sum (only(a) - only(b)), you forget about sum() sets. You have to wrtite a set expression so that the totals can be calculated.
Thanks.. after looking at the pivot.. it make sense now.
the only() works when i'm at the lowest value of my pivot, which means i have to expand all the rows.
once i collapse the roll, there's no data to it. that's why there's no value to the total line.
Is there a workaround? so that when it's collapsed, the overall total will work?
Thanks again.
Actually two workarounds:
1) use aggregation function if possible (like sum and so on)
2) use dimensionality() function to determine the level of expression being calculated.
If(dimensionality()=1, expression for subtotals, expression for other cells).
Hi,
I still can't make my expression work.
I have made a similator in attached.
Bascially the percentage by row for zone and month and the selected product is good.
Just that the total percentage is not wanted.
I made a small table below, in the last column, if we can get the expression working, it will be great.
somebody ?
Thanks,