Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Data coming from two data sources

Hi Guys,

Data are coming from two sources. I want to create a data model in such a way that in checks for current month and for current month data is coming from data source A and if month is not the current month data is coming from data source B.

How can i achieve this ?

Thanks,

Girish Inani

5 Replies
sushil353
Master II
Master II

Hi,

Yes, you can achieve this! try something like below:

let vDateCheck  =num(Monthname(Today()))

Temp:

load Max(Date) as sDate

from SourceA;

let vSourceDateCheck = peek('sDate',0,'Temp')

if vDateCheck = vSourceDateCheck then

load * from sourceA;

else

load * from sourceB;

HTH

Anil_Babu_Samineni

Girish Inani wrote:

Data are coming from two sources. I want to create a data model in such a way that in checks for current month and for current month data is coming from data source A and if month is not the current month data is coming from data source B.

How can i achieve this ?

Try Something like this, If possible please try to share few data how fields data looking?

If Month = Max(Month) THEN

SourceA:

Load *, Month From SourceA;

ElseIf

SourceB:

Load *, Month From SourceB;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

Thanks for your reply.

I want the data for all the months, just the current month data should be from Data source A while for previous months the data should be from Data source B.

stabben23
Partner - Master
Partner - Master

Hi,

I should build two variables in script that holds previous month and current month and use them in the where statment.

Anil_Babu_Samineni

I don;t think so does it work for you

How about by using Qualify & UnQualify

Qualify *;

SourceA:

Load *, Month From SourceA;

UnQualify Month;

Qualify *;

SourceB:

Load *, Month From SourceB;

UnQualify Month;


Then Create Straight Table by using Dim

And Expression seems this


just the current month data should be from Data source A while for previous months the data should be from Data source B.


Sum({<SourceA.Month = {'$(=Max(SourceA.Month))'}, SourceB.Month = {'$(=AddMonths(Max(SourceB.Month),-1))'}>} Sales)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful