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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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.

Labels (1)
8 Replies
MK_QSL
MVP
MVP

Use Max(Uke)-1 instead of Max(Uke-1)

Anonymous
Not applicable
Author

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

Join them togheter. not two different expressions.

Anonymous
Not applicable
Author

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),'##,#%')

))

marcus_sommer
MVP
MVP

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

Anonymous
Not applicable
Author

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?

marcus_sommer
MVP
MVP

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

- Marcus

Anonymous
Not applicable
Author

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.

marcus_sommer
MVP
MVP

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

- Marcus