Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculate Expression by Subtraction

Hi,

I have a data set that provides balances at month end for each month.  Example of Data:

Month      Sum(Balance)

201712    21 500

201801    22 900

201802    23 700

I would like to show a bar chart showing the YTD growth in balance for each month from 201712 - for example

201801 = 600 (Sum of 201801 Balance) - (Sum of 201712 Balance)

201802 = 2 200 (Sum of 201802 Balance) - (Sum of 201712 Balance)

Month is loaded as the dimension.

I have tried the following expressions:

(Sum(Balance))-(Sum({<Month={'201712'}>}Balance))

This results in the following results in the bar graph:

201712 = 0

201801 = 22 900

201802 = 23700

(Sum(Balance))-(Sum({<Month={'201712'}>}Total<Month>Balance))

Same Result as Previous one

[Sum(Balance)]-[Sum({<Month={'201712'}>}Balance)]

This Displays No Data

I have also tried to create a separate expression as follows:

FY2017 = Sum({<Month='201712'>}Balance)

I then tried the following expression:

Sum(Balance) - FY2017

This also gives me the following result:

201712 = 0

201801 = 22 900

201802 = 23700

Any ideas?

Thanks

S

1 Solution

Accepted Solutions
Lisa_P
Employee
Employee

This is the expression you need:

Sum(Balance)-Sum({<Month={201712}>}TOTAL Balance)

Subtract.PNG

View solution in original post

5 Replies
Lisa_P
Employee
Employee

This is the expression you need:

Sum(Balance)-Sum({<Month={201712}>}TOTAL Balance)

Subtract.PNG

shiveshsingh
Master
Master

Try this expression

sum(Balance)-sum(TOTAL{<Month = {'201712'}>}Balance)

sasiparupudi1
Master III
Master III

May be try

(Sum(Balance))-(Sum({1<Month={'201712'}>}Balance))

or


(Sum(Balance))-(Aggr(Sum({1<Month={'201712'}>}Balance),YourDimension))

Anonymous
Not applicable
Author

Thank you!! - This worked.

Anonymous
Not applicable
Author

Thank you - This Worked!