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

compare variables in Qlik Sense Table

Hi,

I need help in comparing two variables and use it in a table.

My table consists of multiple columns, consider for example column1 shows the result of variable expression Var1 and similarly column2 shows the result of variable expression Var2.

In column3 I want to compare if Var1 is greater than Var2 and display the result.

Below are the definition for Var1 and Var2. variables are not defined in the script but in the chart.

Var1=if(IsNull([Actual Hours]),if( [Commodity] = 'Dry', 72, 192),[Actual Hours])


Var2=if (isnull([Event Date_Time]),'InTransit',if(isnull((Interval([Event Date_Time]-[Pickup_Date],'HH'))),(Interval([Event Date_Time]-[Received_Date],'HH')),(Interval([Event Date_Time]-[Pickup_Date],'HH'))))

Both Var1 and Var2 will have hours as the result.

 

Labels (2)
1 Reply
justISO
Specialist
Specialist

Hi, have you tried just compare your expressions

If( if(IsNull([Actual Hours]),if( [Commodity] = 'Dry', 72, 192),[Actual Hours]) >

if (isnull([Event Date_Time]),'InTransit',if(isnull((Interval([Event Date_Time]-[Pickup_Date],'HH'))),(Interval([Event Date_Time]-[Received_Date],'HH')),(Interval([Event Date_Time]-[Pickup_Date],'HH')))) ,

if(IsNull([Actual Hours]),if( [Commodity] = 'Dry', 72, 192),[Actual Hours]) )

or maybe like this:

https://community.qlik.com/t5/QlikView-App-Dev/Compare-the-values-of-two-numeric-variables/m-p/52166...