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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
lifesafari
Helper I
Helper I

Calculate minute between two times interval with logical value

Hello, 

 

i have product registration and i have two columns (Stard / End) with time (HH:MM:SS). 


Consideratin i working on 3 tourn:

morning 06.00.00 - 13.59.59

afternoon 14.00.00 - 21.59.59

night 22.00.00 - 05.59.59<

 

and some time are between tiw turn (ex start 13.50 and 14.10) i need to calculate the effective working time on morning, afternood and night if value on column "Tiype" have value = 2. 
For example 13.50 - 14.10 -> 10 minutes on morning and 10 minutes on afternoon. 

I try to do this but not working 😞

DurataEffettiva =
IF(
LavMacchina[Tipo] = 2,
IF(
HOUR(LavMacchina[Inizio]) >= 6 && HOUR(LavMacchina[Fine]) <= 13,
MINUTE(LavMacchina[Fine]) - MINUTE(LavMacchina[Inizio]),
IF(
HOUR(LavMacchina[Inizio]) < 6,
MINUTE(DATEADD(LavMacchina[Inizio], 6, HOUR)) + MINUTE(LavMacchina[Fine]) - MINUTE(DATEADD(LavMacchina[Fine], 14, HOUR)),
MINUTE(LavMacchina[Fine]) - MINUTE(DATEADD(LavMacchina[Inizio], 6, HOUR))
)
),
MINUTE(LavMacchina[Fine]) - MINUTE(LavMacchina[Inizio])
)

Also try this

2Mattina =
    SUMX(
        FILTER(
            LavMacchina,
            LavMacchina[Tipo] = 2 &&
            HOUR(LavMacchina[Inizio]) >= 6 &&
            HOUR(LavMacchina[Fine]) <= 14 &&
            LavMacchina[Fine] < TIME(14, 0, 0)
        ),
        MINUTE(LavMacchina[Fine]) - MINUTE(LavMacchina[Inizio])
    )
5 REPLIES 5
lifesafari
Helper I
Helper I

Please check the link, it requires access.

Hello, i resolve. I'm sorry for that 

lifesafari
Helper I
Helper I

Hello, thanks for reply.

 

This is an example of my dataset:

TypeDescMachineCodeStartEndMinutes% Equipment
3Fermo Tec. > 10 min998102/12/2023 13:3102/12/2023 14:1045,001,00
278Fermata Programmata998102/12/2023 12:4502/12/2023 13:3045,001,00
1Inizio Lavoro998102/12/2023 12:3202/12/2023 12:4413,001,00
2Attrezzaggio Regolazioni998102/12/2023 11:4002/12/2023 12:3152,001,00
3Fermo Tec. > 10 min998102/12/2023 09:4002/12/2023 11:39120,001,00
1Inizio Lavoro998102/12/2023 08:3502/12/2023 09:3965,001,00
274Ri-attrezzaggio998102/12/2023 07:5002/12/2023 08:3445,001,00
3Fermo Tec. > 10 min998102/12/2023 07:0502/12/2023 07:4945,001,00
1Inizio Lavoro998102/12/2023 06:0002/12/2023 07:0465,001,00
1Inizio Lavoro998102/12/2023 05:3702/12/2023 05:5923,001,00
2Attrezzaggio Regolazioni998102/12/2023 04:2702/12/2023 05:3670,001,00
1Inizio Lavoro998102/12/2023 03:4602/12/2023 04:2641,001,00
2Attrezzaggio Regolazioni998102/12/2023 03:0102/12/2023 03:4545,001,00


This is what i expected 

TypeDescMachineCodeStartEndMinutes% EquipmentTournMinutTournTournMinutTourn
3Fermo Tec. > 10 min998102/12/2023 13:3102/12/2023 14:1045,001,00Morning29Night10
278Fermata Programmata998102/12/2023 12:4502/12/2023 13:3045,001,00Morning45  
1Inizio Lavoro998102/12/2023 12:3202/12/2023 12:4413,001,00Morning13  
2Attrezzaggio Regolazioni998102/12/2023 11:4002/12/2023 12:3152,001,00Morning52  
3Fermo Tec. > 10 min998102/12/2023 09:4002/12/2023 11:39120,001,00Morning120  
1Inizio Lavoro998102/12/2023 08:3502/12/2023 09:3965,001,00Morning65  
274Ri-attrezzaggio998102/12/2023 07:5002/12/2023 08:3445,001,00Morning45  
3Fermo Tec. > 10 min998102/12/2023 07:0502/12/2023 07:4945,001,00Morning45  
1Inizio Lavoro998102/12/2023 06:0002/12/2023 07:0465,001,00Morning65  
1Inizio Lavoro998102/12/2023 05:3702/12/2023 05:5923,001,00Night23  
2Attrezzaggio Regolazioni998102/12/2023 04:2702/12/2023 05:3670,001,00Night70  
1Inizio Lavoro998102/12/2023 03:4602/12/2023 04:2641,001,00Night 41  
2Attrezzaggio Regolazioni998102/12/2023 03:0102/12/2023 03:4545,001,00Night45  

 

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.