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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
SJ
Helper I
Helper I

Relating time range data to individual dates in dataset

We are trying to look at order behaviour versus stocking policy.

 

01-Sep-2017 to 31-12-2017 SKU 1 is available in warehouse X & Y

01-Jan-2018 to 15-Mar-2018 SKU 1 is available in warehouse X

16-Mar-2018 to 17-Jun-2018 SKU 1 is available in warehouse Y

 

To enable us to see how the customer ordering behaviour is affecting our ability to ship to the customer. I would like to pull the available warehouse through to each of my orders.

 

The order would contain an order date and SKU number.

 

How do I relate the warehouse back to the order?

2 ACCEPTED SOLUTIONS
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @SJ,

 

Based on my understanding, you have two tables:

DateRange table: SKU, StartDate, EndDate, WareHouse

Order table: SKU, OrderDate

 

You could create a calculated table with this formula:

Result Tb =
SELECTCOLUMNS (
    FILTER (
        CROSSJOIN ( 'Date Range', Orders ),
        'Date Range'[SKU] = Orders[Order SKU]
            && Orders[OrderDate] >= 'Date Range'[StartDate]
            && Orders[OrderDate] <= 'Date Range'[EndDate]
    ),
    "SKU", Orders[Order SKU],
    "Date", Orders[OrderDate],
    "warehouse", 'Date Range'[warehouse]
)

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi Yuliana,

 

I found the logic by looking at some of you had provided in your initial suggestion above and then researching online:

 

Production Location = CALCULATE(FIRSTNONBLANK('Direct SKUs'[Production Location],1),FILTER(ALL('Direct SKUs'),'Direct SKUs'[Material]='SAP Delivery Data'[Material] && 'Direct SKUs'[Date From]<='SAP Delivery Data'[Deliv.Date] && 'Direct SKUs'[Date To]>'SAP Delivery Data'[Deliv.Date]))

 

So although your solution was not what i was looking it helped me to the right one.

 

Thanks for your support.

Soren

View solution in original post

4 REPLIES 4
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @SJ,

 

Based on my understanding, you have two tables:

DateRange table: SKU, StartDate, EndDate, WareHouse

Order table: SKU, OrderDate

 

You could create a calculated table with this formula:

Result Tb =
SELECTCOLUMNS (
    FILTER (
        CROSSJOIN ( 'Date Range', Orders ),
        'Date Range'[SKU] = Orders[Order SKU]
            && Orders[OrderDate] >= 'Date Range'[StartDate]
            && Orders[OrderDate] <= 'Date Range'[EndDate]
    ),
    "SKU", Orders[Order SKU],
    "Date", Orders[OrderDate],
    "warehouse", 'Date Range'[warehouse]
)

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Yuliana,

 

Thanks for your reply and sorry for my delay in trying this out (Was given other priorities to deal with first).

I have now tried your proposal but it doesn't necesarily answer my question.

 

Your solution creates a further table which I am not interested in.

 

All I want to do is showing the Warehouse on the Orders table.

Do you havea solution to this?

 

Regards,

Soren

Hi Yuliana,

 

I found the logic by looking at some of you had provided in your initial suggestion above and then researching online:

 

Production Location = CALCULATE(FIRSTNONBLANK('Direct SKUs'[Production Location],1),FILTER(ALL('Direct SKUs'),'Direct SKUs'[Material]='SAP Delivery Data'[Material] && 'Direct SKUs'[Date From]<='SAP Delivery Data'[Deliv.Date] && 'Direct SKUs'[Date To]>'SAP Delivery Data'[Deliv.Date]))

 

So although your solution was not what i was looking it helped me to the right one.

 

Thanks for your support.

Soren

Thanks I will give this a go.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors