Hello,
I have some questions on one of my models. Hope you can give me some advice. Thank you so much in advance! @DavidSmith
Here is the background information:
1) Source Module:
Flat file without time dimension
UNIQUE ID | PRODUCT CODE | MONTH NO | WEEK NO | EFFECTIVE DATE | END EFFECTIVE DATE | FOB |
115331062155501-OCT-18 | 1153 | 10/1/2018 | 40 | 10/1/2018 | 12/31/2018 | 11.107 |
115331062155501-JAN-18 | 1153 | 1/1/2018 | 1 | 1/1/2018 | 9/30/2018 | 10.792 |
115331062155531-MAR-19 | 1153 | 3/1/2019 | 13 | 3/31/2019 | 3/31/2019 | 11.107 |
115331062155503-FEB-19 | 1153 | 2/1/2019 | 5 | 2/3/2019 | 3/30/2019 | 11.107 |
115331062155501-JAN-19 | 1153 | 1/1/2019 | 1 | 1/1/2019 | 2/2/2019 | 11.107 |
115331062155529-APR-19 | 1153 | 4/1/2019 | 18 | 4/29/2019 | 12/31/2019 | 11.107 |
115331062155528-APR-19 | 1153 | 4/1/2019 | 17 | 4/28/2019 | 4/28/2019 | 11.422 |
115331062155501-APR-19 | 1153 | 4/1/2019 | 14 | 4/1/2019 | 4/27/2019 | 11.422 |
2) Calculation Module:
Dimension: by month, by product
Calculate: 1) average price for the current month, 2) the price for the latest date in previous month if current month doesn’t have any price data.
3) Issue: How to deal with 3 prices in April and using 4/29/2019 price (11.1) for May?
Solved! Go to Solution.
Hello @Wendy ,
This is one way to acheive this, but there could be more as ways as well.
Average Price | Transactions.FOB[AVERAGE: Transactions.Effective Date, AVERAGE: Transactions.Product Code] |
Last transaction date | Transactions.Effective Date[MAX: Transactions.Product Code, MAX: Transactions.Effective Date] |
Last transaction | IF Last transaction date = Transactions.Effective Date THEN ITEM(Transactions #) ELSE BLANK |
Last transaction @ FG | Last transaction |
Last price of the month | Transactions.FOB[LOOKUP: Last transaction @ FG] |
Offset Price | OFFSET(Last price of the month, -1, 0) |
Hope it helps.
Regards
Arun
@ArunManickam Thank you so much for your suggestion! However, it appears that "Last transaction" line item in Module "Transaction data- By dimension" is empty. How did you get them in your test model? Thanks!
@Wendy ,
Just wanted to pass this along, but the period should not be part of the code. In this instance, if I am reading it correctly, the code or list member should only be the transaction number (1062155501, 1062155531, 1062155503, etc.). Take a look at this article which shows why having date or period in the code is not good for performance:
https://community.anaplan.com/t5/Best-Practices/Data-Hubs-Purpose-and-Peak-Performance/ta-p/48866
Thanks,
Rob
Agreed! However, IT department can't provide the data with transaction numbers. That's why we had to create "unique ID' to do workaround.
@Wendy ,
I would recommend using what you have, without the Date as part of the key:
115331062155531 |
115331062155503 |
115331062155501 |
115331062155529 |
115331062155528 |
The reason being is have the same code, 115331062155501 repeated 4 times, just a different month. If you removed the date from the code, you would only have this listed once in the list.
Thanks,
Rob
Hi Rob,
Yes, the concatenation of those combination without date is only on the List once by using 1st occurrence. The reason for including date in the "unique" ID is to capture all transactions. I wish that we have better clean data to deal with. Thanks!
Wendy