Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using expressions and conditional dimension

Hi all,

I am quite new to expressions but very proficient with writing SQL. I am having slight problems translating simple SQL queries to expressions in qlikview. Currently i'm trying to figure out the following. Also anyone can tell me what is the difference between "conditional dimension" & "expressions".

Assuming that from a single dimension table, I simply want to translate it to a bar chart showing these 2 below, how do I go about this, This seems very simple but I am learning this concept, thx in advance!

Query1

select count(*) from dim_time

where time_id = 0;

Query2

select count(*) from dim_time

where time_id > 0;

Dim_time table

TIME_ID

-------------

0

0

11

21

22

1234

11

0

0

67

0

3 Replies
Nicole-Smith

I like to think about dimensions and expressions as being the x and y axes on a bar chart.  Dimensions go across the x-axis (the buckets), and expressions are the calculation of a value for how large the bar will be (how far it goes up the y-axis).  You can put conditions on dimensions to display the top 10, show a total bar, etc.

To create a chart with your data is seems like you want your Dimension to be TIME_ID and your Expression to be count({<TIME_ID={0}>}TIME_ID) for Query1 and count({<TIME_ID={'>0'}>}TIME_ID) for Query 2.

Not applicable
Author

Nicole's set analysis looks correct, but if you are still intimidated by set analysis you can use a simple IF, THEN, ELSE statement

Sum(if(Time_ID =0,1,0))        as ______

Sum(if(Time_ID>0,1,0))         as ______

Anonymous
Not applicable
Author

The Set Analysis is fully correct. Talking about the concept of Condicional Dimension and Expressions:

Expression is what you wanna see and the dimension is by what. The condicional dimension is when you don't want your dimension be the same in a chart, for example.