Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Unable to solve, product code mapping related problem.

I have common problem however unable to solve using power query or DAX

Have a sales table in SQL which has product code, country of sales, day of transaction and sales amount, doesnt cotain product name. For product name we have product code mapping table in excel. 

Issue is after certain date the product names gets changed. We need to plot product name wise sales with the dates.

 

Sales table

CountryProduct CodeDate              Sales
India32562/1/2019          8,023
China955812/1/2019          6,541
India95582/1/2020          7,058
China95589/1/2020          8,165
India95589/1/2021          6,739
China955810/1/2021          7,343
India325611/1/2021          7,519
China32564/1/2022          6,944
India325611/1/2022          7,787
China95581/1/2023          8,060
India95582/1/2023          6,400

 

Mapping Table in Excel

          

Product CodeProduct nameProduct name after 9/1/2021
9558Product AProduct M
3256Product CProduct N

 

Would you please help me solve this.

Thanks

3 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi some_bih, Thank you for promt response, I have already created relationship between tables, however challenges comes while writing measures because of changing names after certain dates. Could you share your Dax to resolve the issue. Thanks


  • some_bih's avatar
    some_bih
    Community Champion

    Hi Anonymous if you want to trace changing names for product you should provide inputs like StarDate and EndDate for each product code, depending on inputs (modeling this part in overall model) solution could be achived.

    The best would be that in separate process you check if product is changed name and decide what is product name for current /alwasy and that value consider in model.