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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
dandaanilreddy
Partner - Creator III
Partner - Creator III

how to overwrite a DB value in expression

Hi All,

I'm trying to over write a value coming from DB table with some calculations. Tried if condition on expression but not working. Please can someone let me know how to solve ?

A result should be 350/200 =  1.75

DB values:

Dimension value
A 100
B 200
C 350
Labels (1)
1 Solution

Accepted Solutions
dandaanilreddy
Partner - Creator III
Partner - Creator III
Author

I have used total in set analysis and it worked.

If(dim = ‘A’, sum(total {<dim = {‘B’}>} value)/sum(total {<dim = {‘C’}>} value))

View solution in original post

5 Replies
edwin
Master II
Master II

trying to picture what you want to happen, can you pls create a table:

Dimension expression result
A 100/200 = .5 is this expected for A?
B 200/200 = 1 ? is this expected for B?
C 350/200=1.75
dandaanilreddy
Partner - Creator III
Partner - Creator III
Author

Hi Edwin,

Thanks for your reply. I'm getting monthly data from DB for each value in dimension where i created yearly data in qlik script as the user wants to see yearly data also. For some of the dimensions i need to apply calculations on top of what am getting from DB. In the above example i have a value for A , B, C from DB where am showing both monthly and yearly data. For monthly data i should not apply any calculation for A but coming to yearly data i need to apply calculation for A value to be calculated by A= C/B. 

Expected output:

ion value
A 1.75  
B 200
C 350
dandaanilreddy
Partner - Creator III
Partner - Creator III
Author

I have used total in set analysis and it worked.

If(dim = ‘A’, sum(total {<dim = {‘B’}>} value)/sum(total {<dim = {‘C’}>} value))

edwin
Master II
Master II

if your table is strictly what youve pasted, you wouldnt need to add  "TOTAL"

edwin
Master II
Master II

or at least SHOULDNT need to add TOTAL