Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have a question on how to define the set analysis of a measure using data coming from multiple tables (to semplify let me use two tables)
Attached the example
how can I create a measure "net Price" = "gross Price" * (1-"Discount") where the discount is the one active when the unit has been invoiced?
thank you for the help and the patience
Davide
you can try something like below. Make sue to replace field reference with your actual field names
// Your discount table
Discount_map:
mapping load Model& Floor((FromDate+IterNo()-1)) as Key,
Discount
FROM Table
While FromDate+IterNo()-1<=ToDate;
//main tale
Data:
load [Serial No],
[Invoice Date],
Model,
[Gross Price],
ApplyMap('Discount_map',Model&floor([Invoice Date]),1) as Discount
FROM Table;
Hi, I think it will be better if you assign the discount % to each row in script.
Using intervalmatch you can assign each % discount to the invoiceline.
Check the example2 it uses ProductionLne as you should use Model to assign % by model and date range
Hi Ruben, thank you for the kind help.
I apologize for my bad understanding on how scripts work but I tried to replicate the example given in the link you sent and I don't get the result shown in the article (in the output table I don't see all the fileds).
Let me put it in a different way starting from the example in the link.
I run the intervalmatch but i need the field "Order" mapped into the table EventLog
How to do that?
thanks a lot
Davide
you can try something like below. Make sue to replace field reference with your actual field names
// Your discount table
Discount_map:
mapping load Model& Floor((FromDate+IterNo()-1)) as Key,
Discount
FROM Table
While FromDate+IterNo()-1<=ToDate;
//main tale
Data:
load [Serial No],
[Invoice Date],
Model,
[Gross Price],
ApplyMap('Discount_map',Model&floor([Invoice Date]),1) as Discount
FROM Table;