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

Price history in visualexpression

Hi,

I would like to show a simple price history in a table and diagram.

For this I have a date and a part number as the dimension and the price. The date is linked to the master calendar.

In the raw data there are part numbers with several dates with the same price and different prices (see table).

Example:

PartNoDatePrice
1100001.01.202115,50
1100003.01.202115,50
1100004.01.202116,00
1100006.02.202116,10
1100007.02.202116,10
1100009.04.202116,10
1100010.04.202113,00

 

In the price history, only one price change should be used.
If the price remains the same at another point in time, it should not be displayed.

The result should then look like this:

PartNoDatePrice
1100001.01.202115,50
1100004.01.202116,00
1100006.02.202116,10
1100010.04.202113,00

 

Does anyone have any idea how I can do this?

13 Replies
reporting_neu
Creator II
Creator II
Author

Sorry for not answering until today. I was on vacation.

I was able to test the supplementary formula from you. However, it doesn't work properly. This means that I get multiple values again when the customer is selected.

CustomerPartNoDatePrice
10133301.02.202138,00
10133305.04.202138,00
10133308.04.202138,00

 

But I don't find any logical flaw in your formula. Or did I miss something?

Kushal_Chawda

@reporting_neu  share some sample with expected output. I will try to validate it

reporting_neu
Creator II
Creator II
Author

Excerpt from script:

 

NoConcatenate
TMP_U1:
Load 
      DocumentType
    , Part
    , Date
    , Price
    , Customer
From [lib://.../.../transform/Data.qvd]
(qvd)
Where DocumentTypte='R' and Price>0;

//*****************************************

NoConcatenate
TMP_U2:
Load *
Where Price_Flag=1;
Load *,
 if((Customer=Previous(Customer) and Part=Previous(Part) and Date<>Previous(Date) and Price<>Previous(Price))
    or (Part<>Previous(Part) or Customer<>Previous(Customer)),1,0) as Price_Flag
Resident TMP_U1
Order by Part, Date;

Drop Table TMP_U1;

Drop Field Price_Flag;

 

 

Result:

DatePartDocumentTypPriceCustomer
19.02.2021100R38,00170
07.04.2021100R38,00170
12.04.2021100R38,00170
09.06.2021100R38,00170
17.03.2021100R27,00160
18.03.2021100R27,00160
18.01.2021300R14,50160
11.02.2021300R14,50160
26.03.2021300R18,00160
26.06.2021300R18,00160

 

Expected output:

DatePartDocumentTypPriceCustomer
19.02.2021100R38,00170
17.03.2021100R27,00160
18.01.2021300R14,50160
26.03.2021300R18,00160

 

A price change should always be determined. For every part and for every customer.

reporting_neu
Creator II
Creator II
Author

I found the mistake. The mistake is the sorting.

That's right:

Order by Custom, Part, Date;

 

I would never have thought that the solution would be so simple 😅