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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Uspace87
Resolver III
Resolver III

Data modelling

Hi all,

 

I n my model I got a "Date Table", "Product Table", a fact table with "Sold qty" by date and by product and then I got anothe table with all the "Product Unit cost" by product, by date.

 

I would like to find the best way to calculate "Sold Qty * Unit cost" over time. 

 

What's the best solution in terms of data modelling/ dax?

 

thank you everyone.

2 REPLIES 2
Chakravarthy
Resolver II
Resolver II

 ,  If continuous dates are available, then you can merge tables in Power Query (Select multiple columns by pressing ctrl) and  get cost column in fact. You can do the same by below columns in Fact Table. 

New column = 
maxx(filter(Price , Fact[product id] = Price[product id] &&  Fact[Date] = Price[Date]), Price[Price])

 

(OR)

 

New column = 
var _1 = maxx(filter(Price , Fact[product id] = Price[product id] &&  Fact[Date] <= Price[Date]), Price[Price]) 
return 
maxx(filter(Price , Fact[product id] = Price[product id] &&  Fact[Date] = _1 ), Price[Price])

@Uspace87

Idrissshatila
Super User
Super User

Hello @Uspace87 ,

 

in the data modeling you will be having the date and product tables linked to both facts, and calculate a dax measure to see sold qty from fact table * the unit sold from the second fact table.

 

you then display the measure  with respect to the product from the product table.



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors