8 Replies Latest reply: May 10, 2016 10:08 AM by Marcus Sommer

# Need help code, expressions.

Hi!

Can someone help me combine these two expressions:

1:

if(vChange=1,

num(sum(pick(match(Målepkt_Gruppering, 22), kWhVG)) - sum(kWh),'##0'), //numbers

num((sum(pick(match(Målepkt_Gruppering, 22), kWhVG)) - sum(kWh))/sum(kWhVG) ,'##,#%') //percentage

)

2:

Sum({<Uke= {\$(= max(Uke-1))}>}kWh)

Sum({<Uke= {\$(= max(Uke-1))}>}kWhVG)

info;

I have a pivot table that displays the difference between two values ( Diff HM-UM) and i want the right collum/row to show the same as Diff HM-UM but only the last week.

You know if i select week 6, i want the collum on the right to show me values for week 5.

• ###### Re: Need help code, expressions.

Sum({<Uke= {\$(= max(Uke-1))}>}kWh) works fine, but i need to combine the expressions.

Join them togheter. not two different expressions.

• ###### Re: Need help code, expressions.

This dosent work but i need something like this:

if(vChange=1,

num(sum(pick(match(Målepkt_Gruppering, 22), Sum({<Uke= {\$(= max(Uke)-1)}>}kWhVG))) - Sum({<Uke= {\$(= max(Uke)-1)}>}kWh),'##0'),

num((sum(pick(match(Målepkt_Gruppering, 22), Sum({<Uke= {\$(= max(Uke)-1)}>}kWhVG))) - Sum({<Uke= {\$(= max(Uke)-1)}>}kWh)/sum(kWhVG),'##,#%')

))

• ###### Re: Need help code, expressions.

I have the impression that your expressions are more complicated as necessary - therefore try something like this:

num(sum(({< Målepkt_Gruppering = {22}>} kWhVG) - sum(kWh)) / if(vChange=1, sum(kWhVG), 1), if(vChange=1,'##0','##,#%'))

num(sum(({< Målepkt_Gruppering = {22}, Uke= {"\$(=max(Uke)-1)"}>} kWhVG) - sum({< Uke= {"\$(=max(Uke)-1)"}>} kWh)) / if(vChange=1, sum(kWhVG), 1), if(vChange=1,'##0','##,#%'))

- Marcus

• ###### Re: Need help code, expressions.

thanks for reply, but it didnt work.. error in expressions..

I have a button that switch between number and percentage...

I want the collum on the right to show the same as Diff HM-UM, But only Last week.

so if i choose week 6, Diff HM-UM displays the difference in week 6, and then i want the collum on the right will automaticly show week 5.

Do you have som more suggestions?

• ###### Re: Need help code, expressions.

An alternative would be to use two expressions either within a expression-group or with a visibility-condition.

- Marcus

• ###### Re: Need help code, expressions.

No, i just want the "Diff HM-UM" to show Last week. and not the month, year or day i choose.  a gruop dosent do this.

this one is okay and works fine, but i want another one that only display the values of last week. So i can compare weeks.

• ###### Re: Need help code, expressions.

I think a small example with a few inline-data will be useful.

- Marcus