Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
manoranjan_d
Specialist
Specialist

Sate in the expression

Hi all,

I have declerared a state1 and state2 in the document property and assigned the state1 to the list box1 and state2 to the list box2, in order to make comparison.

now in the straight table expression i want to declare this state1 in the calcualtion part, for the below calcualtion.

=(if(amt='',0,amt))-(if(base_amt='',0,base_amt))



normally we will assign the state1

=sum({[State1] * $}amt) so our expression will be OK



but how to bring the state1 in the if loop =(if(amt='',0,amt))-(if(base_amt='',0,base_amt))


6 Replies
sunny_talwar

May be this

=Only({[State1]} (if(amt='',0,amt))-(if(base_amt='',0,base_amt)))

tresesco
MVP
MVP

Try with Only() like:

=Only({[State1]}(if(amt='',0,amt))-(if(base_amt='',0,base_amt)) )


sunny_talwar

Or this

If(Only({[State1]} amt) ='', 0, Only({[State1]} amt)))-(If(Only({[State1]} base_amt) ='', 0, Only({[State1]} base_amt)))

manoranjan_d
Specialist
Specialist
Author

thanks but in the expression label

i want to give the expression  label name with dynamic selection of the week

example if i select the week1 in the list box 1, since list box 1 has been defined with state1

then the expression label has to show "week1 total amt"

but this is not working

=Only({[State1]}if(GetSelectedCount(Week_Num1)>=1,Week_Num1,'Week')) & 'total amt'


its not showing


its showing only week total amt but as the requiremet is shd show


"week1 total amt" bcoz i slected week1

manoranjan_d
Specialist
Specialist
Author

sunny can u reply me

sunny_talwar

May be this

=If(GetSelectedCount(Week_Num1, False(), 'State1')>=1, Only({[State1]}Week_Num1), 'Week') & 'total amt'