Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum not appearing for Expressions with before Function

=

Hi All,

I have a pivot table with following expression,

Before(

sum((-1*(Val* pick(wildmatch(Type,'A', 'B','*'),$(ADi)/100, $(BDi)/100, 1)))+Val )
,
pick(wildmatch(Type,'A', 'B','*'),$(AMv), $(BMv), 0)
)

where i am moving a defined percentage of field to next N column using variables, now i need to show the total of the this column in the bottom using partial sum, but its not working, any idea ?

Thanks in advance

Jeswanth

3 Replies
Not applicable
Author

Just learned about adding code snippet to forums 🙂 thought of explaining the same again with the new tags.

i have a pivot table where i do what if analysis where every dimension will have a percentage and a delay, so i add pct and delays and create a what if scenario using following code



Before(
SUM((-1*(Val* pick(wildmatch(Type,'A', 'B','*'),$(ADi)/100, $(BDi)/100, 1)))+Val )
,
pick(wildmatch(Type,'A', 'B','*'),$(AMv), $(BMv), 0)
)




and this expression dont create partial sums but if i try teh same without before function which is used for delays the partial sum works fine like teh following


sum((-1*(Val* pick(wildmatch(Type,'A', 'B','*'),$(ADi)/100, $(BDi)/100, 1)))+Val )


any idea why the above dont calculate sum ?

it will great if some one can help me out here.

Jeswanth

brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi,

the pivottable needs a function for the sum, that's why you need to aggregate your expression by one or more dimenions:

Sum(Aggr(your_expression),Dimension1,Dimension2,...))

Not applicable
Author

Thanks Martina,

I tried that alredy and it comes for the second code snippet above, but when i try teh same for first one with Before it returns Zero. Any idea if we need to take care when use Before function ? see what i tried below


Sum(
Aggr(
Before(
Sum((-1*(Val* pick(wildmatch(Type,'A', 'B','*'),$(ADi)/100, $(BDi)/100, 1)))+Val )
,
pick(wildmatch(Type,'A', 'B','*'),$(AMv), $(BMv), 0)
),Type))


I have a sample qvw file, but not seeing any option to share teh same here. at least you can see a screen shot here.

This one before using Aggr Function

Jeswanth