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: 
georgianamha
Contributor II
Contributor II

sum the difference between the two measures

Hi,

When i add this measure  sum ([Sales value BGN] - [Cost value BGN]) i receive the message "Error in expression"

Both sales and cost values BGN are measures - sum (sales) and sum(cost) 

I just started in the reporting area and i have no clue why the expression is not correct

Do you have ideas?

Thank you!

Labels (1)
4 Replies
lukas_
Contributor III
Contributor III

Hi,

Are [Sales value BGN] and [Cost value BGN] in purple and identified as main measures?

vinieme12
Champion III
Champion III

Double aggregation is not possible

Sum(sum( sales))

 

You can just use your actual expressions 

=Sum(Sales)-Sum(Cost) 

 

If you need to further aggregate the result of this, then it needs to be wrapped in Aggr()  as below 

=Sum ( Aggr ( 

Sum(Sales)-Sum(Cost) 

, Dimension1, Dimension2) )

 

Replace Dimension1 and Dimension2 with the fields used in your chart /table or add more separated by commas as needed based on what granularity you need to aggregate it result on

 

 

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
edwin
Master II
Master II

try separating them into two columns:
 sum ([Sales value BGN])

and sum([Cost value BGN])

and these are both numeric?

georgianamha
Contributor II
Contributor II
Author

thank you!! i separated them and it worked 🙂