 Former Member

# can we filter filter based on transactional data ?

Hi experts,

I want to calculate the price based on the inputed value of another KPI.

my model have the below dimensions:

Article

Slice: members: 1 , 2 ,3 and NA(Non Applicable)

Version :C type

Time.

Supplier

TV_PDT: The account dimension where i have my KPIs , I have quantity and price .

normaly if the quantity is ≤100 T the price will be 1200 DH/T,if it's between 101T and 250 T the price is 1150 DH/T and if it's >250 T the price will be 1100 DH/T.

is it possible ?if yes how can I achieve that.

what I suggest is to input quanity for Slice=NA and then if the quantity is

is ≤100 we do a rec statement and save data for Slice =1 and crash the record for Slice=NA

same for other slices.

regards

10|10000 characters needed characters exceeded

Posted on Mar 07, 2017 at 08:16 PM

If you want to store also price:

```*WHEN TV_PDT
*IS quantity
*WHEN Slice
*IS NA
*REC(EXPRESSION=%VALUE%<=100 ? %VALUE% : 0,Slice=1)
*REC(EXPRESSION=%VALUE%>100 ? (%VALUE%<=250 ? %VALUE% : 0)  : 0,Slice=2)
*REC(EXPRESSION=%VALUE%>250 ? %VALUE% : 0,Slice=3)
*REC(EXPRESSION=%VALUE%<=100 ? 1200 : 0,Slice=1,TV_PDT=price)
*REC(EXPRESSION=%VALUE%>100 ? (%VALUE%<=250 ? 1150 : 0)  : 0,Slice=2,TV_PDT=price)
*REC(EXPRESSION=%VALUE%>250 ? 1100 : 0,Slice=3,TV_PDT=price)
*REC(EXPRESSION=0) //Clear NA
*ENDWHEN
*ENDWHEN```
10|10000 characters needed characters exceeded
• Former Member

• Posted on Mar 07, 2017 at 06:26 PM

Sorry but not clear...

Where do you want to perform this conditional calculation?

On the report with Excel formula?

Or in script logic (default.lgf?)?

10|10000 characters needed characters exceeded
• Not clear how do you want to save Price???

• Posted on Mar 07, 2017 at 06:37 PM

Ok, now it's clear that you are talking about script logic!

But the calculation logic is not clear:

"what I suggest is to input quanity for Slice=NA and then if the quantity is

is ≤100 we do a rec statement and save data for Slice =1 and crash the record for Slice=NA

same for other slices."

You want to input quantity for Slice=NA and depending on the value post to 1, 2, 3?

10|10000 characters needed characters exceeded
• Posted on Mar 07, 2017 at 08:10 PM

The following code will do the job (just to copy quantity):

```*WHEN Slice
*IS NA
*REC(EXPRESSION=%VALUE%<=100 ? %VALUE% : 0,Slice=1)
*REC(EXPRESSION=%VALUE%>100 ? (%VALUE%<=250 ? %VALUE% : 0)  : 0,Slice=2)
*REC(EXPRESSION=%VALUE%>250 ? %VALUE% : 0,Slice=3)
*REC(EXPRESSION=0) //Clear NA
*ENDWHEN```