Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
amit_saini
Master III
Master III

Expression Help???

Hi Folks ,

Please see the attachment and suggest why below expression is not working for ABC Target values:

if(GetFieldSelections(Major_Decfect_Grp_Cat)='Quality'

        , sum({1<Plant_Name ={'$(=getfieldselections(Region1))'}, Month -={'-'}>}[QDR Target])

        , if(getfieldselections(Major_Decfect_Grp_Cat)='Non-Quality'

            ,sum({1<Plant_Name ={'$(=getfieldselections(Region1))'}, Month-={'-'}>}[QDR Target NQ])

            , sum({1<Plant_Name ={'$(=getfieldselections(Region1))'}, Month-={'-'}>}[QDR Target NQ] + [QDR Target])

            )

    )

Thanks,

AS

1 Solution

Accepted Solutions
amit_saini
Master III
Master III
Author

I tried below expression and it is working fine:

(if(GetFieldSelections(Major_Decfect_Grp_Cat)='Quality'

        , sum({1<Region1={$(Variable1)}, Month-={'-'}>}[QDR Quality defects targets])

        , if(getfieldselections(Major_Decfect_Grp_Cat)='Non-Quality'

            ,sum({1<Region1={$(Variable1)}, Month-={'-'}>}[QDR Non Quality defects targets])

            , sum({1<Region1={$(Variable1)}, Month-={'-'}>}[QDR Non Quality defects targets] + [QDR Quality defects targets])

            )

    ))/12

Thanks,

AS

View solution in original post

9 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

In what way is it not working?

Is Month-={'-'} intended to remove nulls?

The expression [QDR Target NQ] + [QDR Target] will return null if either value is null, and will be 0 in the sum. Use

     Sum({....} RangeSum([QDR Target NQ] + [QDR Target]))

   

Or add two Sum() expressions together.

Please reduce the data in your sample:Preparing examples for Upload - Reduction and Data Scrambling

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

t1.png

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

Please reduce the data in your sample:Preparing examples for Upload - Reduction and Data Scrambling

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
MK_QSL
MVP
MVP

I can't find Quality and Non-Quality in Decfect group? Am I missing something?

amit_saini
Master III
Master III
Author

Hi Jonathan,

Already did this , size before was 180 MB and now I have reduced it to 18MB.

Yes Month-=('-') is to remove null , but if I'm keeping this simple Month= than also I'm not getting Target values.

I have tried rangesum also , it's not working.

Thanks,

AS

amit_saini
Master III
Master III
Author

Sorry Manish,

I did scrambling of data:

  

CkocicwQuality
Hyo-MrczpyhNon-Quality

Thanks,

AS

MK_QSL
MVP
MVP

Because of Scrumbling,, Plant_Name will not match to GetFieldSelection(Region1)...

amit_saini
Master III
Master III
Author

ahh... Yes you are right !

amit_saini
Master III
Master III
Author

I tried below expression and it is working fine:

(if(GetFieldSelections(Major_Decfect_Grp_Cat)='Quality'

        , sum({1<Region1={$(Variable1)}, Month-={'-'}>}[QDR Quality defects targets])

        , if(getfieldselections(Major_Decfect_Grp_Cat)='Non-Quality'

            ,sum({1<Region1={$(Variable1)}, Month-={'-'}>}[QDR Non Quality defects targets])

            , sum({1<Region1={$(Variable1)}, Month-={'-'}>}[QDR Non Quality defects targets] + [QDR Quality defects targets])

            )

    ))/12

Thanks,

AS