Forum Discussion

avalonds's avatar
avalonds
Frequent Visitor
8 years ago
Solved

Changes in item code

I have the following tables in powerbi as noted below. Some products in my Dim-product table have changed the item code over the years to be a different item code. This is seen in the Dim-Product changes table which is a stand alone table. Also have a Dim-Date table that connects to my Facts Sales table.

 

 

 

My goal is to create a slicer that allows the user to see sales of products either with the changes or without the changes to the item code. Here's how the solution would look like. Ideally my fact sales tables has other attributes such as units and Gross margin as well and would like the slicer to work with these attributes as well.

 

 

What would be the best way to tackle this problem?

Tables as text format below:

Dim-Product Table
Item code (key)Attributes
Product 1Blue
Product 2Green
Product 3Yellow
Product 4Purple
Product 5Blue
Product 6Black
Product 7Red
Product 8

Magenta

 

Dim-Product Changes Table
Item code (new)Item code (old)Date Changed
Product 1Product 41-Mar-18
Product 3Product 74-Feb-18
Product 4Product 830-Jun-17

 

Fact Sales Table
Order IDItem codeSalesSales Calendar Date
100Product 1$                     1001-May-18
102Product 3$                     3001-Jun-18
103Product 6$                     50023-Apr-18
112Product 6$                       303-Apr-18
113.3Product 7$                       2022-Dec-17
114.6Product 4$                       10Nov-17
115.9Product 8$                       4014-Feb-17

 

 

5 Replies

    • avalonds's avatar
      avalonds
      Frequent Visitor

      Thanks Greg. I've updated the initial post to include tables. Hope this helps!

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        I think that what you need to do is to make your product change table inclusive. By that I mean, you need to have it so that you would add records for:

         

        Product 1 -> Product 1

        Product 6 -> Product 6

         

        If you had it that way, then you could use the Item ID column from this table in your first result table and the Item ID column from your fact table in your second result table. This would give you the intended effect of seeing it with or without changes. You could then create a button or two that would be tied to bookmarks to switch between the two views of the data.