Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
manas_bn
Creator
Creator

ApplyMap with a parameter to use in Where clause

Hello all,


I have a scenario as shown below:

FactTable:

UserMonthUsage DateProductKey
U1M19/3/2013P11
U1M19/3/2013P2

2

U1M18/30/2013P13

MappingTable:

ProductMapped ProductFrom DateTo Date
P1P29/1/201310/1/2013
P1P38/1/20138/31/2013

Based on the "Usage Date" field in the Fact table I have to pick the Mapped Product in MappingTable.

So the End Table should look like:

UserMonthDateProductKey
U1M19/3/2013P21
U1M19/3/2013P2

2

U1M18/30/2013P33

Is there a way I can use ApplyMap to pass the UsageDate field as a parameter to use in the where clause and build a dynamic mapping table?

map:

mapping load

Product, MappedProduct

Resident MappingTable

where From Date<=(VariableDate) and ToDate>=(VariableDate); //VariableDate is the Usage Date in Fact Table.

Also is there any other direction I need to go with to achieve this (preferably avoiding joins)?

Thanks in advance for your help!

1 Solution

Accepted Solutions
vikasmahajan

You need to apply Interval Match Function instead of Apply Map , See demo attached.

Hope this helps you.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.

View solution in original post

3 Replies
vikasmahajan

You need to apply Interval Match Function instead of Apply Map , See demo attached.

Hope this helps you.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
er_mohit
Master II
Master II

See the attached pdf

manas_bn
Creator
Creator
Author

Thanks a lot Vikas, Mohit! This is exactly what I needed!