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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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())


Follow on LinkedIn
@ 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!:
DAX For Humans

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)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
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())


Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors