Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Kirsten
Creator II
Creator II

Creating column with calculated measure 2019-2018

How to create an additional column with the delta between 2019 and 2018 through a calculated measure

What should the expression look like. see attachment. I assume the expression needs to be added when you select add under measure fX and fill in the expression

Labels (1)
12 Replies
Kushal_Chawda

are there two different expression or just single expression (Consumed Qty)?

Kirsten
Creator II
Creator II
Author

It is 1 variable/metric called consumed YTD (euro) =  Sum([Consumed [YTD]]])  This variable is applicable for 2018 and 2019. File looks like this

Year      product       Consumed YTD

2019        a                     300

2019        b                     500

2018         c                    200

Kushal_Chawda

what is the expected output need in pivot table?

Vegar
MVP
MVP

Try to create a measure named "Delta " with the expression 

RangeSum(-Before([Delta ConsumedEuro]), Sum(ConsumedEuro))

image.png

 

Kirsten
Creator II
Creator II
Author

I am getting an error in the expression. See attachment.

Somehow my default expression is [Consumed [YTD]]]  not sure why the extra brackets. Just when I add this measure to the pivot  in the measure field it by default looks like this

I have tried with and without the extra brackets

Vegar
MVP
MVP

Try to  replace the outer [ ] with " " like this

 "Consumed [YTD]]"

It might help. 

Kirsten
Creator II
Creator II
Author

Hi thanks. It doesn't work, still have an error. Where in this code do you define that you compare 2019 to 2018?

RangeSum(-Before([Delta "[Consumed [YTD]]]"),Sum("[Consumed [YTD]]]"))

Kirsten
Creator II
Creator II
Author

I just need to have a fairly simple delta  [Qty Consumed [YTD]]]from year 2019 -/- [Qty Consumed [YTD]]]from year 2019

So something like [Qty Consumed [YTD]]]=2019 - [Qty Consumed [YTD]]]=2018

But then in the right code. Can not find it in the tutorial video's

Kirsten
Creator II
Creator II
Author

Is there someone else who has a different solution? Code above doesn't work for me