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

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

Reply
evadung
Frequent Visitor

Calculate production time*quantity

Hello, I need to calculate production time*quantity in DAX. I have two tables and calendar table.

 

1) first table with production time for each item.

ItemStart dateEnd dateProduction time
A12.1.202014.2.2022

7

A14.2.202215.5.20237,2
A15.5.202315.5.20307,3
B30.5.201130.5.20206
B30.5.202029.6.20305,9

 

2) second table

ItemDateQuantity
A25.5.20213
A14.3.20226
A16.8.20231
B21.8.20232

 

I was thinking using {Number.From([Start date])..Number.From([End date])} in Query, but I think it is pointless. Totaly have no clue how to do it easier. Thanks for any help.

1 ACCEPTED SOLUTION
SamInogic
Super User
Super User

Hi @evadung ,

It seems that you want to retreieve the Production Time in second table based on Date if it falls within start date and end date of First Table.

So, You can follow below steps to achieve your requirement.

1. Create a column in Second table with below DAX expression:

FinalCalculation =

var sampledate = 'Table Second'[Date].[Date]

var productiontime =

    CALCULATE (

       MIN('Table'[Production time]),

        FILTER (

            'Table',

            'Table'[Start date].[Date] <= sampledate

                && 'Table'[End date].[Date] >= sampledate && 'Table Second'[Item] = 'Table'[Item]

        )

    )

    return productiontime*'Table Second'[Quantity]

 

Please refer to the below screenshot for the same.

SamInogic_0-1692602590672.png

 

This will give below output,

SamInogic_1-1692602598028.png

 

Thanks!

 

Inogic Professional Services Division

Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

Drop an email at crm@inogic.com

Services:  http://www.inogic.com/services/

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

View solution in original post

2 REPLIES 2
SamInogic
Super User
Super User

Hi @evadung ,

It seems that you want to retreieve the Production Time in second table based on Date if it falls within start date and end date of First Table.

So, You can follow below steps to achieve your requirement.

1. Create a column in Second table with below DAX expression:

FinalCalculation =

var sampledate = 'Table Second'[Date].[Date]

var productiontime =

    CALCULATE (

       MIN('Table'[Production time]),

        FILTER (

            'Table',

            'Table'[Start date].[Date] <= sampledate

                && 'Table'[End date].[Date] >= sampledate && 'Table Second'[Item] = 'Table'[Item]

        )

    )

    return productiontime*'Table Second'[Quantity]

 

Please refer to the below screenshot for the same.

SamInogic_0-1692602590672.png

 

This will give below output,

SamInogic_1-1692602598028.png

 

Thanks!

 

Inogic Professional Services Division

Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

Drop an email at crm@inogic.com

Services:  http://www.inogic.com/services/

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

Thank you! 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.