Forum Discussion
Multiple fact table and linking
I am having a hard time relating two tables with different dimensions.
Below, I provide a mockup file showing ACTUALS and TARGET information. ACTUALS are shown per dateday, while TARGETS are only specified for either week day or weeken day. Both have a corresponding dimension CATEGORY. I am not able to share files on this forum yet (lost login of prior account due to switching organisation), so I also share wetransfer link with the excel file. I am very much aware someone should be hesitant to download an excel file from an unkown user so I copy paste these tables below.
Could someone help me find a good way modeling these tables together to show an overview of the sales per day with the target next to it?
I see it should be possible using the query editor to merge both fact tables into one table, but I am not very sure how this works concerning performance, as well I'd like to stick to the modeling part in the relations window to preserve understandability for other users.
Thank you in advance!
https://wetransfer.com/downloads/36dc0fe9432775324cf03c51711f406b20181109102055/2a31c7
OR
Targets:
| Day_type | Category | Target_location_A | Target_location_B | Target_location_C |
| Week day | A | 400 | 500 | 525 |
| Weekend day | A | 425 | 525 | 575 |
| Week day | B | 315 | 415 | 440 |
| Weekend day | B | 340 | 440 | 490 |
| Date | Category | Actuals_location_A | Actuals_location_B | Actuals_location_C |
| 1-1-2018 | A | 500 | 400 | 400 |
| 2-1-2018 | A | 700 | 300 | 560 |
| 4-1-2018 | A | 610 | 450 | 540 |
| 5-1-2018 | A | 450 | 500 | 560 |
| 7-1-2018 | A | 540 | 560 | 500 |
| 8-1-2018 | A | 610 | 660 | 560 |
| 9-1-2018 | A | 560 | 390 | 660 |
| 11-1-2018 | A | 660 | 450 | 390 |
| 12-1-2018 | A | 390 | 440 | 450 |
| 13-1-2018 | A | 410 | 500 | 540 |
| 15-1-2018 | A | 450 | 560 | 610 |
| 16-1-2018 | A | 440 | 610 | 440 |
| 17-1-2018 | A | 500 | 450 | 500 |
| 18-1-2018 | A | 560 | 540 | 560 |
| 19-1-2018 | A | 520 | 660 | 610 |
| 21-1-2018 | A | 530 | 390 | 450 |
| 22-1-2018 | A | 430 | 410 | 500 |
| 23-1-2018 | A | 400 | 500 | 560 |
| 25-1-2018 | A | 500 | 400 | 540 |
| 26-1-2018 | A | 400 | 560 | 660 |
| 28-1-2018 | A | 300 | 520 | 390 |
| 29-1-2018 | A | 450 | 390 | 630 |
| 31-1-2018 | A | 500 | 410 | 400 |
| 1-1-2018 | B | 425 | 325 | 325 |
| 2-1-2018 | B | 625 | 225 | 485 |
| 4-1-2018 | B | 535 | 375 | 465 |
| 5-1-2018 | B | 375 | 425 | 485 |
| 7-1-2018 | B | 465 | 485 | 425 |
| 8-1-2018 | B | 535 | 585 | 485 |
| 9-1-2018 | B | 485 | 315 | 585 |
| 11-1-2018 | B | 585 | 375 | 315 |
| 12-1-2018 | B | 315 | 365 | 375 |
| 13-1-2018 | B | 335 | 425 | 465 |
| 15-1-2018 | B | 375 | 485 | 535 |
| 16-1-2018 | B | 365 | 535 | 365 |
| 17-1-2018 | B | 425 | 375 | 425 |
| 18-1-2018 | B | 485 | 465 | 485 |
| 19-1-2018 | B | 445 | 585 | 535 |
| 21-1-2018 | B | 455 | 315 | 375 |
| 22-1-2018 | B | 355 | 335 | 425 |
| 23-1-2018 | B | 325 | 425 | 485 |
| 25-1-2018 | B | 425 | 325 | 465 |
| 26-1-2018 | B | 325 | 485 | 585 |
| 28-1-2018 | B | 225 | 445 | 315 |
| 29-1-2018 | B | 375 | 315 | 555 |
| 31-1-2018 | B | 425 | 335 | 325 |
1 Reply
- v-cherch-msftMicrosoft Employee
Hi Anonymous
I can't download the file as it is expired. It seems you may try to add columns to get the value from TARGET table as below:
Day_type = IF ( WEEKDAY ( 'Fact'[Date], 1 ) < 6, "Week day", "Weekend day" )
Target_Location_A = LOOKUPVALUE ( Target[Target_location_A], Target[Day_type], 'Fact'[Day_type], Target[Category], 'Fact'[Category] )Regards,
Cherie