Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
grggmrtn
Post Patron
Post Patron

Star schema with a factless fact table - a new "keyless" table got added but I need to access it...

I have the perfect star schema going on in our dataset - seriously, it's beautiful 🙂 I just hope I can explain my problem just as beautifully...

Our fact table is "factless", meaning it only contains the primary keys to all the dimensions. All calculations are done through relationships and measures. 

BUT

A new table just got thrown at us, and I'm not quite sure what to do with it. It contains the prices of our products, and when the prices were active - something like this:

DistributorProductPriceStartPriceStopPrice
VKClothing01.01.202231.12.2022164,73
VKFood01.01.202131.12.2021157,22
VKFood01.01.202231.12.2022162,23
HGClothing01.01.202230.06.2022122,34
HGClothing01.07.202231.12.2022125,66
HGFood01.07.202131.12.2021145,89
HGFood01.01.202130.06.2021123,44
HGFood01.01.202230.06.2022156,44

As you can see, prices for the same products can differ depending on the Distributor and date.

Using relations for this seems like a real challenge, considering that our distributor is in one dimension table, the products in another, and of course there's the date table...

So what I need is the price per distributor per product by date. I'll be making calculations in my report by all three things (the price data will be used for billing).

Does anyone have any ideas as to how I can go about doing this?

1 ACCEPTED SOLUTION
grggmrtn
Post Patron
Post Patron

I actually found the answer @amitchandak - and it might be what you were trying to tell me...

I first expanded the PriceStart and PriceStop columns, creating a row ([Date]) for each date between the two. It created a much larger table, but one which was much easier to work with.

Then I created a new column in my fact table, using LOOKUPVALUE to insert the price into it

LOOKUPVALUE (
    Prices[price],
    Prices[Date], RELATED(Date[Date]),
    Prices[Distributor], RELATED(Distributor[DistributorName]),
    Prices[Product], RELATED(Product[ProductName])
)

It worked like a charm.

View solution in original post

4 REPLIES 4
grggmrtn
Post Patron
Post Patron

I actually found the answer @amitchandak - and it might be what you were trying to tell me...

I first expanded the PriceStart and PriceStop columns, creating a row ([Date]) for each date between the two. It created a much larger table, but one which was much easier to work with.

Then I created a new column in my fact table, using LOOKUPVALUE to insert the price into it

LOOKUPVALUE (
    Prices[price],
    Prices[Date], RELATED(Date[Date]),
    Prices[Distributor], RELATED(Distributor[DistributorName]),
    Prices[Product], RELATED(Product[ProductName])
)

It worked like a charm.

amitchandak
Super User
Super User

@grggmrtn , You can use this table to populate data in fact. First of add the keys here.

 

Then using those keys (equal to ) and between join of dates, create a new column in fact for price

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

I'm sorry, you lost me at the very beginning?

@grggmrtn , Please share expected output, see If I can get it

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.