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
Anonymous
Not applicable

DateDiff error

Hi Guys,

 

I need a help with a following:

 

For each PackageCode I need to find Delta Time (StateChangeTs) between Destination = DynamicTester_9_1_2_ModuleLocation and Destination=DynamicTester_9_1_2_OutputBuffer. 

This code gives me an error: 

Cycle Time = DATEDIFF(MAXX(FILTER('Dynamic Tester 9_1_1'[Destination]="DynamicTester_9_1_2_ModuleLocation",'Dynamic Tester 9_1_1'[StateChangeTs] <EARLIER('Dynamic Tester 9_1_1'[Destination]="DynamicTester_9_1_2_OutputBuffer",'Dynamic Tester 9_1_1'[StateChangeTs])), 'Dynamic Tester 9_1_1'[StateChangeTs],second))
Error: Too many arguments were passed to the MAXX function. The maximum argument count for the function is 2.
 
Ps: The query name is Dynamic Tester 9_1_1.

Capture.PNG

 

Also how can I include a condition that specifically for the same PackageCode the formula shall do DateDiff, so in case if the same two PackageCode rows are not in the sequence, it can do correct calculation

1 ACCEPTED SOLUTION

@Anonymous - Probably easier if you break it down:

 

Cycle Time = 
  VAR __Table = FILTER('Dynamic Tester 9_1_1', [Destination]= "DynamicTest_9_1_2_ModuleLocation" && [StateChangeTs] < EARLIER([StateChangeTs]))
  VAR __Time1 = MAXX(__Table,[StateChangeTs])
  VAR __Time2 = 'Dynamic Tester 9_1_1'[StateChangeTs]
RETURN
  IF([Destination] = "DynamicTester_9_1_2_OutputBuffer",DATEDIFF(__Time1,__Time2,second),BLANK())

@ 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...

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Like this

Cycle Time = DATEDIFF(MAXX(FILTER('Dynamic Tester 9_1_1', [Destination]= EARLIER([Destination]) && [StateChangeTs] <EARLIER([StateChangeTs])),[StateChangeTs]), 'Dynamic Tester 9_1_1'[StateChangeTs],second)

Anonymous
Not applicable

Capture2.PNG

 

Thanks for reply. Not sure that really works. Cause the Delta T does for the same Package Code does look correct. I would like specifically to put condition that for Time(1) the destination is DynamicTester_9_1_2_ModuleLocation and for Time(2) is DynamicTester_9_1_2_OutputBuffer

@Anonymous - Probably easier if you break it down:

 

Cycle Time = 
  VAR __Table = FILTER('Dynamic Tester 9_1_1', [Destination]= "DynamicTest_9_1_2_ModuleLocation" && [StateChangeTs] < EARLIER([StateChangeTs]))
  VAR __Time1 = MAXX(__Table,[StateChangeTs])
  VAR __Time2 = 'Dynamic Tester 9_1_1'[StateChangeTs]
RETURN
  IF([Destination] = "DynamicTester_9_1_2_OutputBuffer",DATEDIFF(__Time1,__Time2,second),BLANK())

@ 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...

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.