Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Keshav_singh
Contributor
Contributor

Conditional Expression not working in the Table.

I created a variable called threshold_upper. Now, I want the table to filter according to the values assigned to the variable.

The write a syntax in conditional expression but it is not working.

Keshav_singh_0-1683181204328.png

Suggest me if something is wrong in this or any other formula.

Labels (1)
1 Solution

Accepted Solutions
joshsiddle8
Contributor III
Contributor III

To filter a table based on the values assigned to the variable threshold_upper, you can use conditional expressions in your syntax. Here's an example of how you can accomplish this:

python
Copy code
# Assuming you have a table called 'data_table' with a column named 'value'

# Assign a value to the threshold_upper variable
threshold_upper = 50

# Filter the table based on the threshold_upper variable
filtered_table = data_table[data_table['value'] > threshold_upper]
In the above code, we compare the 'value' column of the 'data_table' with the threshold_upper variable using the greater than (>) operator. This will filter the table and create a new table called 'filtered_table' that only includes rows where the 'value' is greater than the assigned threshold.

Make sure you have assigned a numeric value to the threshold_upper variable before using it in the conditional expression. Also, ensure that the table and column names in your code match your actual data structure.

If you're encountering any issues or errors with your syntax, please provide more details or the specific error message so that I can assist you further Consultant CRM Salesforce.

View solution in original post

3 Replies
marcus_sommer

In general it should work. I suggest to test the logic at first with a fixed value - means replacing the variable with any value like 10000 which would exclude any possible issues with the variable. If this proved that the logic and and the expression-syntax with all brackets are ok. it means that the variable-value isn't valid, for example because it's a string and not a number or the value isn't properly formatted and containing any comma as thousand/decimal delimiter.

Kushal_Chawda

@Keshav_singh  When you say it is not working, is it not giving expected results or not at all giving any value? Possibly if your variable is having some expression make sure that your expression starts with "=", otherwise it will not be evaluated and compared with condition in measure.

joshsiddle8
Contributor III
Contributor III

To filter a table based on the values assigned to the variable threshold_upper, you can use conditional expressions in your syntax. Here's an example of how you can accomplish this:

python
Copy code
# Assuming you have a table called 'data_table' with a column named 'value'

# Assign a value to the threshold_upper variable
threshold_upper = 50

# Filter the table based on the threshold_upper variable
filtered_table = data_table[data_table['value'] > threshold_upper]
In the above code, we compare the 'value' column of the 'data_table' with the threshold_upper variable using the greater than (>) operator. This will filter the table and create a new table called 'filtered_table' that only includes rows where the 'value' is greater than the assigned threshold.

Make sure you have assigned a numeric value to the threshold_upper variable before using it in the conditional expression. Also, ensure that the table and column names in your code match your actual data structure.

If you're encountering any issues or errors with your syntax, please provide more details or the specific error message so that I can assist you further Consultant CRM Salesforce.