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
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
Drop an email at crm@inogic.com
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
Drop an email at crm@inogic.com
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

Thank you! 

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!

November Carousel

Fabric Community Update - November 2024

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

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.