Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
I have 3 tables Fact, Dim1, Dim2.
Fact table contains BCode,Pcode,Amount
Dim1 contains BCode,Unit
Dim2 contains PCode,Region,Country
My requirement is if i select Unit = Unit2 and Country = Thailand then my actual Region = Asia
But as per my req i need to show if i select Unit = Unit2 and Country = Thailand then Region = China
I am attaching sample QVW also. Could you please somebody help me here?
Thanks,
Chiru
I think Brad is right and you need to do a mapping, the example you provided is a little limited, but something like this should work
mapping
OverrideChinaMapping:
load
'Asia_Thailand' as Key,
'China' as Region
AutoGenerate(1);
Fact:
LOAD * Inline [
BCode,PCode,Amount
B1,P1,10
B2,P1,11
B3,P2,10
B4,P2,15
B5,P3,20
B6,P3,10
B7,P4,22
B7,P4,33
];
Dim1:
LOAD * Inline [
BCode,Unit
B1,Unit1
B2,Unit1
B3,Unit2
B4,Unit2
B5,Unit3
B6,Unit3
B7,Unit4
B8,Unit4
];
Dim2:
load
PCode,
ApplyMap('OverrideChinaMapping',Region&'_'&Country,Region) as Region,
Country;
LOAD * Inline [
PCode,Region,Country
P1,Asia,India
P2,Asia,Thailand
P3,China,China
P4,Europe,England
];
Hi,
Hope you know, if there is related data in your source, it data will show automatically.
In your table, the country data 'Thailand' not related with Region 'China'.
is there any logic to get the data?
Hi Periasamy,
Actually my requirement is i need to map if Unit = Unit2 and Country = Thailand then Region to China.
I tried using some joins in script level but didn't get exact required output.
Thanks,
Chiru
Chiranjeevi,
You need to create 2 Mapping tables 1 for Unit & 1 for Region & when using apply map, if your unit map is satisfied apply region map inside it.
like, applymap(Unit,applymap(Region),'None').
Thanks
Brad.
Hi Bharadwaaj,
Could you please give sample QVW.
It's my request to you. Hope you will accept it.
Thanks,
Chiru
I think Brad is right and you need to do a mapping, the example you provided is a little limited, but something like this should work
mapping
OverrideChinaMapping:
load
'Asia_Thailand' as Key,
'China' as Region
AutoGenerate(1);
Fact:
LOAD * Inline [
BCode,PCode,Amount
B1,P1,10
B2,P1,11
B3,P2,10
B4,P2,15
B5,P3,20
B6,P3,10
B7,P4,22
B7,P4,33
];
Dim1:
LOAD * Inline [
BCode,Unit
B1,Unit1
B2,Unit1
B3,Unit2
B4,Unit2
B5,Unit3
B6,Unit3
B7,Unit4
B8,Unit4
];
Dim2:
load
PCode,
ApplyMap('OverrideChinaMapping',Region&'_'&Country,Region) as Region,
Country;
LOAD * Inline [
PCode,Region,Country
P1,Asia,India
P2,Asia,Thailand
P3,China,China
P4,Europe,England
];
Thanks Ramon,
Chiranjeevi, Check out Ramon's reply. He explained it pretty good & a sample QVW always helps if you can provide.
Thanks
Brad.
Chiranjeevi,
here is a sample qvw based on above script.
Thanks
Brad.