Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
dhasharadh
Creator III
Creator III

Urgent help required please

Hi All what is the meaning of high lighted one in the below script please. am new to this app some one developed i entered without KT.

is that division with applymap result. am bit confused please help me as it is very urgent. Thanks much

Data:
Load
*,
SERVICE_ID & '-' & DerCalltypeName & '-' & left(EVENT_MONTH_KEY, 6) as Key_SERVICE_ID_CallType_Month,
left(EVENT_MONTH_KEY, 6)&'|'&SERVICE_ID  as MONTH_SERVICE_KEY,
date(makedate(left(EVENT_MONTH_KEY,4),mid(EVENT_MONTH_KEY,5,2),1),'MMM YYYY') as Month,
if(DerCalltypeName='Data',DURATION,0) / Applymap('DurationFactors',DerCalltypeName,1) as DataVolume,
if(DerCalltypeName='Voice',DURATION,0) / Applymap('DurationFactors',DerCalltypeName,1) as VoiceVolume,
if(DerCalltypeName='SMS',DURATION,0) / Applymap('DurationFactors',DerCalltypeName,1) as SMSVolume

Resident
FNU_Data;

Drop Table FNU_Data;

IF DurationFactors is the applymap table name then i dont see  any inline table or other with that name. please help my counts with are deviating a lot.

6 Replies
YoussefBelloum
Champion
Champion

Hi,

if you're talking about the highlighted 1 in the applymap, it is the else part of the applymap(), if this function finds nothing, it will return 1 as an output

shiveshsingh
Master
Master

lets take example of if(DerCalltypeName='Data',DURATION,0) / Applymap('DurationFactors',DerCalltypeName,1) as DataVolume,

For numerator,  if DerCalltypeName is 'Data', then output will be DURATION value else 0

For denominator, you are pulling mapping value of DerCalltypeName from table DurationFactors, if no value is found then it will be 1.


in qlikview 11, this code will run without defining the mapping table but in QV 12, you need to define the maping table else it will throw an error.

dhasharadh
Creator III
Creator III
Author

thanks for the quick reply.

if(DerCalltypeName='Data',DURATION,0) / Applymap('DurationFactors',DerCalltypeName,1) as DataVolume

in the above line i didnt understand the / Applymap('DurationFactors',DerCalltypeName,1) are we doing a division on the if condition result, if yes. can you describe the current apply map which is mentioned above. if DurationFactors is the table name, then i have that table like below


DurationFactors:
Mapping
Load * Inline [
CallType, Factor
Data, 1
Voice, 1
SMS, 1
Video Call, 1

]
;

i know the applymap syntax but the above is confusing me, please elaborate it.

shiveshsingh
Master
Master

from  this table FNU_Data, you are matching field DerCalltypeName with mapping table(DurationFactors) column CallType.


If DerCalltypeName = Data, then it will return 1, if it is Voice, then again 1 and so on. Your denominator will be 1.

sasiparupudi1
Master III
Master III

Yes, it does not make sense to divide the value with 1.. may be applymap table needs some other values

you might aswell remove the applymap completely

sasiparupudi1
Master III
Master III

Have you managed to get this sorted?