Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Demo calculation

Hi Team,

Can anyone please help me in writing the simplified sql code for this. Thanks in advance.

SET DEMO_UE = if(getSelectedCount(GEN_DESC,true())> 0

or (GETOBJECTFIELD(0) = 'GEN_DESC') 

or (GETOBJECTFIELD(1) = 'GEN_DESC')

or (GETOBJECTFIELD(2) = 'GEN_DESC')

or (GETOBJECTFIELD(3) = 'GEN_DESC')

or (GETOBJECTFIELD(4) = 'GEN_DESC')

or (GETOBJECTFIELD(5) = 'GEN_DESC')

or (GETOBJECTFIELD(6) = 'GEN_DESC')

,

SUM(distinct GEN_UE),1)

// End of gender

*

if(

getselectedcount(AGE_GROUP_DESC,true())> 0

or (GETOBJECTFIELD(0) = 'AGE_GROUP_DESC') 

or (GETOBJECTFIELD(1) = 'AGE_GROUP_DESC')

or (GETOBJECTFIELD(2) = 'AGE_GROUP_DESC')

or (GETOBJECTFIELD(3) = 'AGE_GROUP_DESC')

or (GETOBJECTFIELD(4) = 'AGE_GROUP_DESC')

or (GETOBJECTFIELD(5) = 'AGE_GROUP_DESC')

or (GETOBJECTFIELD(6) = 'AGE_GROUP_DESC')

,

SUM( distinct AGE_UE)

//SUM(1)

,

1)

//End of age group

*

if(getSelectedCount(MARITAL_DESC,true())> 0

or (GETOBJECTFIELD(0) = 'MARITAL_DESC') 

or (GETOBJECTFIELD(1) = 'MARITAL_DESC')

or (GETOBJECTFIELD(2) = 'MARITAL_DESC')

or (GETOBJECTFIELD(3) = 'MARITAL_DESC')

or (GETOBJECTFIELD(4) = 'MARITAL_DESC')

or (GETOBJECTFIELD(5) = 'MARITAL_DESC')

or (GETOBJECTFIELD(6) = 'MARITAL_DESC')

,

SUM(distinct 

MARITAL_UE

),1)

//End of marital group

*

if(getselectedcount(RACE_DESC,true()) > 0

or (GETOBJECTFIELD(0) = 'RACE_DESC') 

or (GETOBJECTFIELD(1) = 'RACE_DESC')

or (GETOBJECTFIELD(2) = 'RACE_DESC')

or (GETOBJECTFIELD(3) = 'RACE_DESC')

or (GETOBJECTFIELD(4) = 'RACE_DESC')

or (GETOBJECTFIELD(5) = 'RACE_DESC')

or (GETOBJECTFIELD(6) = 'RACE_DESC')

,

SUM(distinct 

RACE_UE

),

1)

//End of race

*

if(getSelectedCount(HISPANIC_DESC,true())> 0

or (GETOBJECTFIELD(0) = 'HISPANIC_DESC') 

or (GETOBJECTFIELD(1) = 'HISPANIC_DESC')

or (GETOBJECTFIELD(2) = 'HISPANIC_DESC')

or (GETOBJECTFIELD(3) = 'HISPANIC_DESC')

or (GETOBJECTFIELD(4) = 'HISPANIC_DESC')

or (GETOBJECTFIELD(5) = 'HISPANIC_DESC')

or (GETOBJECTFIELD(6) = 'HISPANIC_DESC')

,

SUM(distinct

HISPANIC_UE

),1)

//End of hispanic

*

if(getSelectedCount(INCOME_DESC,true())> 0

or (GETOBJECTFIELD(0) = 'INCOME_DESC') 

or (GETOBJECTFIELD(1) = 'INCOME_DESC')

or (GETOBJECTFIELD(2) = 'INCOME_DESC')

or (GETOBJECTFIELD(3) = 'INCOME_DESC')

or (GETOBJECTFIELD(4) = 'INCOME_DESC')

or (GETOBJECTFIELD(5) = 'INCOME_DESC')

or (GETOBJECTFIELD(6) = 'INCOME_DESC')

,

SUM(distinct

INCOME_UE

),1)

//End of income

*

if(getSelectedCount(EDU_DESC,true())> 0

or (GETOBJECTFIELD(0) = 'EDU_DESC') 

or (GETOBJECTFIELD(1) = 'EDU_DESC')

or (GETOBJECTFIELD(2) = 'EDU_DESC')

or (GETOBJECTFIELD(3) = 'EDU_DESC')

or (GETOBJECTFIELD(4) = 'EDU_DESC')

or (GETOBJECTFIELD(5) = 'EDU_DESC')

or (GETOBJECTFIELD(6) = 'EDU_DESC')

,

SUM(distinct

EDU_UE

),1)

// End of gender

;

1 Reply
Not applicable
Author

We are trying to calculate a measure which is based on this macro coding. Please help me in achieving this

NUM((SUM(RAW_AA)/($(=DEMO_UE)

*MODE(TMS_ADJ_DURATION)))/Count(distinct ADJ_TMS_ID1)*100,'0.00' )