Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bharatkishore
Creator III
Creator III

Loading dummy data

Hi All,

I have a qvd and loaded two fields, i.e.

load

country,

district,

'1' as kpi scope added a dummy field.

Now when i reload it i will get KPI scope as 1. Now  i want to get 0 also in that field.

Is there  only way is concatenation or any other way.. please let me know.

Thanks,

Bharat

1 Solution

Accepted Solutions
sunny_talwar

That is because you might have a 5th value (or may be more than 5 values) for [contract at consumption_u] field. Try this

If([contract at consumption_u] = 'Contract Covered', 'C',

If([contract at consumption_u] = 'Contract Billed', 'C',

If([contract at consumption_u] = 'T&M', 'T',

If([contract at consumption_u] = 'Warranty','W', 'N/A')))) as Entitlement1,

So, when none of the four conditions are met, you will see N/A

View solution in original post

19 Replies
sunny_talwar

You can also do join

Table:

LOAD country,

     district

FROM ...

Join (Table)

LOAD * INLINE [

kpi

1

0

];

tresesco
MVP
MVP

You can concatenate like:

load

     country,

     district,

     '1' as kpi

From <>:

Load

     null() as country,

     null() as district,

     0 as kpi

autogenerate 1;

But I am not sure what could be the case when you would want this. May be based on your business need the code might change accordingly.

bharatkishore
Creator III
Creator III
Author

Hi Sunny,

PFA file for more reference.

Please let me know if this is the correct approach or any other best way.

Thanks,

Bharat

sunny_talwar

What you have should also work, but if you are looking for alternative, try this

Table:

LOAD Country_u,

     Upper(Left([Country_u],2)) as Ctry,

     [contract at consumption_u], 

     if([contract at consumption_u]='Contract Covered' ,'C', if([contract at consumption_u]='Contract Billed','C',if([contract at consumption_u]='T&M','T',if([contract at consumption_u]='Warranty','W')))) as Entitlement1

FROM

(qvd);

Left Join (Table)

LOAD * INLINE [

    KPIScope

    1

    0

];

bharatkishore
Creator III
Creator III
Author

Hi Tresesco,

The reason why i needed KPI scope is as 0 and 1 is,

I have written the following if condition i.e.

if([contract at consumption_u]='Contract Covered' ,'C', if([contract at consumption_u]='Contract Billed','C',if([contract at consumption_u]='T&M','T',if([contract at consumption_u]='Warranty','W')))) as Entitlement1

Now i will be sending this data to a CSV file.

Then in that excel is we filter under Entitlement1 KPI scope should be 1 when it is for Contract Covered, and  KPI scope should be 0 when it is for Contract Billed.

PFA app for more reference.

Thanks,

Bharat

sunny_talwar

What about the other two options under [contract at consumption_u]? T&M AND Warranty?

bharatkishore
Creator III
Creator III
Author

Hi Sunny,

No need for T&M and Warranty.. Just needed only for Contract Covered and Contract Billed..

KPI scope should be 1 for  Contract Covered and KPI scope should be 0 for Contract Billed

Thanks,

Bharat

sunny_talwar

You can try this

Table:

LOAD Country_u,

     Upper(Left([Country_u],2)) as Ctry,

     [contract at consumption_u], 

     if([contract at consumption_u]='Contract Covered' ,'C', if([contract at consumption_u]='Contract Billed','C',if([contract at consumption_u]='T&M','T',if([contract at consumption_u]='Warranty','W')))) as Entitlement1

FROM

(qvd);

Left Join (Table)

LOAD * INLINE [

    KPIScope, contract at consumption_u

    1, Contract Covered

    0, Contract Billed

];

Or you can use ApplyMap

bharatkishore
Creator III
Creator III
Author

Hi Sunny,

I have written this if condition

      if([contract at consumption_u]='Contract Covered' ,'C', if([contract at consumption_u]='Contract Billed','C',if([contract at consumption_u]='T&M','T',if([contract at consumption_u]='Warranty','W')))) as Entitlement1,

Now i need to create KPI scope where KPI scope should be 1 for Contract Covered, T&M and Warranty and KPI scope should be 0 only for Contract Billed.

Sorry for miscommunication earlier.

Please let me know if you need anything more.

Thanks,

Bharat