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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ratercero
Helper III
Helper III

Return earliest result on a batch

Hello,

 

I want to return for each row, the machine number a batch was processd for the first time, the table should look like this:

 

Date and timeMachine #Batch #Machine first Process
01/01/2017 08:001AAAAAA1
01/01/2017 10:004AAAAAA1
01/01/2017 16:007AAAAAA1
01/01/2017 09:009BBBBBB9
01/01/2017 12:003BBBBBB9
01/01/2017 19:0015BBBBBB9

 

 

 

Thanks for the help



1 ACCEPTED SOLUTION

Hi @ratercero,

Please use the formula. And see the result in screenshot.


Column1 = CALCULATE(LOOKUPVALUE(Table2[Machine],Table2[Date],CALCULATE(MIN(Table2[Date]),ALLEXCEPT(Table2,Table2[Batch #]))),ALLEXCEPT(Table2,Table2[Batch #]))


4.PNG

Best Regards,
Angelia

View solution in original post

6 REPLIES 6
Greg_Deckler
Super User
Super User

Maybe something like:

 

Machine first Process = CALCULATE(VALUES([Machine #]),FILTER(ALLEXCEPT(Table,[Batch #]),MIN([Date and time])))

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

 Hello @Greg_Deckler


 

I got this error:


 

Capture.JPG

 

 

 

 

 

Hi @ratercero,

The given table is your expected result table, right? It’s difficult to reproduce your scenario based on your description. Is there any chance to post your resource data for analysis? So that we can post solution which is close to your requirement.

Best Regards,
Angelia

Hello @v-huizhn-msft,

 

here is the file:

 

Test File

 

 

RT

 

 

Thanks to a unique sequential production Id this partially works for me, but does not follow the criterio of earliest start date:

 

1ST_MACHINE = CALCULATE(
FIRSTNONBLANK(
t_Batch[c_MachineId],
t_Batch[c_MachineId]),
FILTER(
ALLEXCEPT(
t_Batch,
t_Batch[BATCH_NUMBER_1]),
MIN(
t_Batch[c_StartedDT])
)

RT

Hi @ratercero,

Please use the formula. And see the result in screenshot.


Column1 = CALCULATE(LOOKUPVALUE(Table2[Machine],Table2[Date],CALCULATE(MIN(Table2[Date]),ALLEXCEPT(Table2,Table2[Batch #]))),ALLEXCEPT(Table2,Table2[Batch #]))


4.PNG

Best Regards,
Angelia

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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