Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
danielnevitt
Creator
Creator

Calculated Dimensions

Hi,

I would really appreciated some help with calculated dimensions.

I have a bar graph and I would like to restrict the data to show only:

IF(MATCH(LOAD_LOC_REF,'USA','NLD','FRA'),LOAD_LOC_REF)

AND/OR

IF(MATCH(DISCH_LOC_REF,'USA',NLD','FRA'),DISCH_LOC_REF)

Both calculated dimensions work seperately, but I am unable to link them together.

Regards,

Daniel

1 Solution

Accepted Solutions
alexandros17
Partner - Champion III
Partner - Champion III

... missing ' ...

final version

IF(MATCH(LOAD_LOC_REF,'USA','NLD','FRA'),LOAD_LOC_REF,

     IF(MATCH(DISCH_LOC_REF,'USA','NLD','FRA'),DISCH_LOC_REF,null())

)

View solution in original post

11 Replies
Not applicable

Upload your sample application

alexandros17
Partner - Champion III
Partner - Champion III

you have in this way a boolean answer,

try this

IF(MATCH(LOAD_LOC_REF,'USA','NLD','FRA'),LOAD_LOC_REF,

     IF(MATCH(DISCH_LOC_REF,'USA',NLD','FRA'),DISCH_LOC_REF),null()

)

Hope it helps

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

What I would do in this situation is to try IF..Then... Else

i.e

IF x=t then ppp

Elseif y=2 Then QQQQ

End IF

I want to beleive you are scripting.......

Give this ago

Regards,

Gabriel

danielnevitt
Creator
Creator
Author

Hi,

I tried to follow your suggestion, but I got an error in the expression.  Is there something I am missing?

Thanks for your help.

Regards,

Daniel

Qlikview.jpg

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Since the conditions for the two are the same, I suggest that you create a combined field from these two fields for your dimension. You can stlll keep the original fields.

Combined:

LOAD Distinct LOAD_LOC_REF As COMB_LOC_REF

Resident ...;

Concatenate(Combined)

LOAD Distinct DISCH_LOC_REF As COMB_LOC_REF

Resident ....;

Without more knowledge of your data structure I cannot advise how to integrate this into your data model.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
danielnevitt
Creator
Creator
Author

Hi,

Is it not possible to write OR statements as a calculated dimension?

Regards,

Daniel

jonathandienst
Partner - Champion III
Partner - Champion III

Daniel

To the best of my knowledge, this is not possible. How would the expression determine which field in the OR had which value?

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
danielnevitt
Creator
Creator
Author

Hi,

Maybe I didn't explain it very well.

If I have the following data:

Company     LOAD_LOC_REF     DISCH_LOC_REF

A                FRA                         USA

B                USA                        GER

C                NLD                         NLD

D                ITL                           POL

E                AUS                        JAP

F                SWE                       NLD

I was trying to write a code that would show me the companies where either LOAD_LOC_REF is FRA, NLD, USA or the DISCH_LOC_REF is FRA, NLD, USA.

Therefore I would expect my bar graph to only show companies A, B, C and F.

Is that possible?

Regards,

Daniel

alexandros17
Partner - Champion III
Partner - Champion III

I'm sorry ... cut and paste

IF(MATCH(LOAD_LOC_REF,'USA','NLD','FRA'),LOAD_LOC_REF,

     IF(MATCH(DISCH_LOC_REF,'USA',NLD','FRA'),DISCH_LOC_REF,null())

)

it must work!!!