Forum Discussion
LASTDATE by skuname
Hmm, I'll have to build a model and test it and get back to you.
First, build a product dimension. You will run into issues and make your life harder if you insist on using only one table. The calculated column you want is just
LastDate = LASTDATE( FactSale[Date] )
This is defined in the product dimension.
Some images of sample data and model.
My model - relationship between DimProduct and FactSale on SKUKeyFactSale data - note the two products with last dates on 2016-01-02 and 2016-01-03.DimProduct, with the calculated column defined and behaving appropriately.
- acanepa10 years ago
Resolver I
Hi,
Thanks for your answer. I follow the same steps that you told me with the example data that you have provided and worked, but later I try with my own data and didn't work, even when the SKU Key is a number and have the exact same type of number: Whole Number.
I have the main table with columns:
date, sku_config, product_name,quantity,visible, skukey
An example column
01-12-15, FA492FB2J1EPKLACL, FA492FA1J1EPKLACL-7645455, Blusa Estilo Europeo, 1, 7645455
*The SKU key take the last 6 numbers of sku simple.
After that I generate a table with the formula:
Last Date Table= Distinct('BD'[Sku Key]After that I created a column in that table with the formula
LD = LASTDATE('BD'[Date])The column LD gives me the same date for all SKU Key: 07 of January
Regards,
- greggyb10 years ago
Resident Rockstar
Have you created a relationship between your fact table and your product dimension with the fact table on the many side and the dimension on the one side?