Skip to main content

Hello everyone, I am trying to make a calculation to tell me the average price for a dynamic quantity range 

I started by doing an LOD with :

{ FIXED [Article Code], ([Quantity]) : AVG([Unit Sales Price])} 

 

that give me the average price per quantity.

But i don't know how to build this LOD for a range value

(for exemple i want to calculate the average price for close quantity ordered)

I want something like this :

{ FIXED [Article Code], [Quantity] - 25,  [Quantity] + 25: AVG([Unit Sales Price])}

 

Thanks in advance

Tilan

4 answers
  1. Jun 29, 2022, 9:51 AM

    thank you again for your help Deepak

    you had a good idea and so I kept trying with your example but didn't work :/

    I broke down my problem to understand better

    I have created 2 values to define the range on which I want to calculate my average (of course threshold will be dynamics)

    thank you again for your help Deepakyou had a good idea and so I kept trying with your example but didn't work :/I broke down my problem to understand betterI have created 2 values to define the rangeFor example i on this 1st line i want to calculate average of unit price for quantity between -25 and 75 ([25-50:25+50])

    I try to create new measure, but it seems calculates average for the same range ([25-50:25+50]) for each "quantity dimension" (line)

    // Gives Average price for [Qty - X : Qty + X]

    {FIXED [Article Code]:AVG(

    IF [Quantity] >=[Treshold min] AND [Quantity] <= [Treshold Max]

    THEN [AVG unit sales price / quantity]

    END)}

    I tried to calculate the average depend on quantity threshold :

    Quantity | Sales unit price Average on quantity between

    25 | -25:75

    50 | 0:100

    75 | 50:150

    ...

    Its like using this range in the LOD

    any idea ?

     

    PS:

    I did someting similar with the tooltip and it seems working

    (With parameter and scope)

    image

0/9000