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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

three conditions in calculated dimension

Hi there,

I need some help, please. I need to get a calculated dimension with three conditions. I have six streets (1-6) and two directions (up/down). I need to set up the dimension with street 3 & 5 combined but only in direction "up".

Can someone help me with it?

Thanks and regards

Benny     

[EDIT] Sorry, I haven't been clear enough...

My streets are 1 to 6 and I want to see it like this:

Street 1, up: 30 cars

Street 2 up: 10 cars

Street 3 down: 50 cars

Street 3 + 1 down: 25 cars

The amount of cars is done in a formula (sum(cars)) but I need the right dimension... Something like

if(street='1' AND direction='up', street,

       if(street='1' AND street='3' AND direction='up', street) )

and so on...

Does that makes sense? The problem is, if the if-condition is fulfilled in another line, the function stops which it shouldn't...

10 Replies
pokassov
Specialist
Specialist

From my point of view the best solution for your situation is changing model.

in case you want to calculate sum(ATM) for RWY=28 twice it's can be helpful.

1. add calculated field in your fact table during load:

fact:

load

...,

autonumber(RWY&'|'&LSV, 'Key RWY LSV')               As %KeyRWYLSV

from...;

2. Add new table

RWY_LSV:

noconcatenate

load distinct

     %KeyRWYLSV,

     if(LSV='up', 'Departure '&RWY,'Arrival '&RWY)               As CurrentStat

resident fact;


3. add linec with group fields

concatenate(RWY_LSV)

load distinct

%KeyRWYLSV,

     if(LSV='up', 'Departure ','Arrival ')&if(match(RWY,28,16)>0,'28&' '&16',if(match(RWY,32,34)>0,'34&' '&32'))               As CurrentStat

resident fact

where match(RWY,28,16,34,32)>0; //write there RWY which your boss want to summarize

then you can use CurrentStat as dimention.