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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Landcrab
Helper I
Helper I

How can I filter the quantity sold in one fact table based on the expiry date in another fact table

Hi there,


I have two fact tables:


-Products Shipped

-Products Sold


And 3 dimension tables:

 

-Item 

-Customer 

-Calendar

 

diagramView.png


The Products Shipped table has two date columns, Shipped Date and Expiry Date where the Shipped Date is in a 1:M relationship with the date column in the Calendar table, and the Expiry Date is not linked to any other tables.

 

Both fact tables have the columns item number, customer number and a date column, that have been set up with 1:M relationship between them and this works as expected.

 

The 1:M relationship between the dimension (Calendar Date) and the fact table dates (Ship Date and Date Sold) work as expected.

 

Now, I can create a visual in Power BI where the Calendar Date filters both the Shipped Quantity and the Sold Quantity based on these relationshipsbetween the tables, and in addition to this, I need it be filter down the Sold Quantity even further to only include Quantities Sold where the where the Expiry Date >= to the Calendar Date, something like this:

 

Calculate (SUM(Quantity Sold), Filter(Product Shipped, Product Shipped[Expiry Date] >= MIN(Calendar[Date]) )

 

However this does not work as there is no direct relationship between the fact tables and the Expiry Date, and,  Expiry Date is in one fact table and the Quantity Sold is in the other fact table that dont have a direct link between the fact tables..


I have tried creating a relationship between the Expiry Date and Calendar Date and merge the two fact tables together to achieve this, but so far no luck.. 

Any ideas how this could be achieved please?

 

Thank you.

1 REPLY 1
amitchandak
Super User
Super User

@Landcrab , In such a case I prefer to bring the data into the same table. Now either based date sold and date shipped and item or Item and batch we need to copy information from one table to another

 

New column in product sold

 

Maxx(filter('product shipped', 'product shipped[Item] = ' product sold'[item] && 'product shipped[batch] = ' product sold'[batch]), 'product shipped'[Expiry Date])

or

//based on order

Maxx(filter('product shipped', 'product shipped[Item] = ' product sold'[item] && 'product shipped[order] = ' product sold'[order]), 'product shipped'[Expiry Date])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors