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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
crln-blue
Post Patron
Post Patron

Measure (DATEDIFF) shows all the wrong dates and scroll bar goes smaller and smaller

Hello everyone,

 

So I'm calculationg the difference between two dates that I have. These dates are connected indirectly via table relationship (date 1 is from table 1, date 2 is from table 3, and their connection is that their is a table relationship between table 1- table 2 and table 2 - table 3).

 

Here is my measure (not a table measure, just a measure):

date 2 - date 1, days = 
//Date 2 - Date 1
//DATEDIFF (Date 1, Date 2)

IF(ISBLANK(MAX(date 1) || ISBLANK(MAX(date 2),
    BLANK(),
    DATEDIFF(MAX(date 1),MAX(date 2),DAY)
)

My goal is when one of the dates has no value, my measure should be blank. Else, subtract the dates. 

 

Below is a screenshot of my table visual without the measure:

Screenshot 2023-10-18 005038.png

I didn't count but maybe there's less than a hundred rows based on the scroll bar.

 

When I put my measure on the the visual, it goes like this:

Screenshot 2023-10-18 005231.png
The data went huge and the scroll bar became smaller and smaller. It feels like I'm scrolling infinitely.

 

I'm guessing that there's something wrong with the calculation.. How do I solve this?

Thank you!

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@crln-blue That doesn't look like correct syntax at all:

 

IF( ISBLANK(MAX([date 1])) || ISBLANK(MAX([date 2])),
    BLANK(),
    DATEDIFF(MAX([date 1]),MAX([date 2]),DAY)
)

 

Also, you could probably speed things up by doing this:

 

VAR __MaxDate1 = MAX([date 1])
VAR __MaxDate2 = MAX([date 2])
VAR __Result = 
IF( __MaxDate1 = BLANK() || __MaxDate2 = BLANK(),
    BLANK(),
    (__MaxDate2 - __MaxDate1) * 1.
)
RETURN
__Result

 

 



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

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@crln-blue That doesn't look like correct syntax at all:

 

IF( ISBLANK(MAX([date 1])) || ISBLANK(MAX([date 2])),
    BLANK(),
    DATEDIFF(MAX([date 1]),MAX([date 2]),DAY)
)

 

Also, you could probably speed things up by doing this:

 

VAR __MaxDate1 = MAX([date 1])
VAR __MaxDate2 = MAX([date 2])
VAR __Result = 
IF( __MaxDate1 = BLANK() || __MaxDate2 = BLANK(),
    BLANK(),
    (__MaxDate2 - __MaxDate1) * 1.
)
RETURN
__Result

 

 



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

Thank you, @Greg_Deckler for the help. Your suggestion also helped me troubleshoot and check each fields. Will mark this question as solved. Thanks again! 

Screenshot 2023-10-18 031912.png

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors