Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Builiding model relationships

Hello,

 

I have the following two tables from a database and I am struggling to create a Power BI model:

 

The data is splited like this:

Table 1:

Time period --> Month and Year

Main category (can be food or non-food)

--> Second Main Category ( each Main Category has 2 or 3 splits, ex: Food splits in Food Beverages and Food Normal)

--> Market (here i have the market where the category has been sold, ex: Hole country, Store 1, Store 2 etc)

--> Fact (is splited in Sales Value and Sales Volume)

--> Category(ex: Dairy)

--> Subcategory (Each Category is splited into one or more Subcategories, ex. Dairy milk, Dairy Youghurt etc)

--> Supplier (each subcategory has many suppliers)

--> Brand (each suppliers has one or more brands)

--> Period 1 and Period 2 are 2 distinct time period measures (ex. Period 1=6 months until now, Period 2= 12 month until now) and I have values for This Year and last year (that means: period 1 This year for time period "November 2019" means cumulated data for May - November 2019), period 1 last year means cumulated data for May - November 2018). Period 2 This Year means cumulated data for December 2018 - November 2019. And in this columns I have values for Sales in Value and in Volume.

 

Ex: For brand Apple let's say I will have the following

 

In Table 2 I have the same structure, just that it is for the Product Level.

 

I have to make an analysis for the development compared to last year for subcategory, supplier, brand and product where I have to calculate Value Change compared to Last Year (for both period 1 and period 2), Value Change % compared to last year, etc. And it has to be for each subcategory, its suppliers, their brands and the brand's products for each store. I will have to have a slicer for Time period, to be able to choose between Period 1 or Period 2, Fact (to choose between Sales or Volume Value, Main Category, Second Main Category, Category and Subcategory.

 

I was thinking about creating a hierarchy Category --> Subcategory --> Supplier --> Brand --> Product and then to create measures and make a matrix with the hierachy, market and measures. But I have to create a relationship between the tables and I have so many columns with repeated values and I don't know how to do it :(. 

 

Could you, please, help me?

 

Thank you!