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

Calculate the number of days between two date columns; positive or negative

 

I have two date columns. To calculate the number of days difference between them, I just created a measure =[Date1]-[Date2]. But the resullts are erroneous. I also created a column using the same formula. The numbers with Measure and Calculated column are equal. 

 

When I exported the data out to excel and took the difference, the results are correct. some of the Power BI numbers are off by exact muiples like 2x, 3x. Not sure why. I want the numbers to indicate +ve or -ve difference. 

Please see the screenshot of the table here: https://imgur.com/a/LHs8H

I cant figure out why. Can someone please help. 

 

1 ACCEPTED SOLUTION
srinivt
Microsoft Employee
Microsoft Employee

Can you share the exact DAX expression you used to build the measure and calculated column expressions? How did you import the data? Can you verify that the dates are accurately recognized during import? Finally, how are you verifying the difference in the data-view or a matrix/table visual? If it is matrix/table visual and using a calculated column, very likely it will be aggregated using a SUM aggregation, which could explain why you are seeing 2X, 3X etc results. 

View solution in original post

2 REPLIES 2
srinivt
Microsoft Employee
Microsoft Employee

Can you share the exact DAX expression you used to build the measure and calculated column expressions? How did you import the data? Can you verify that the dates are accurately recognized during import? Finally, how are you verifying the difference in the data-view or a matrix/table visual? If it is matrix/table visual and using a calculated column, very likely it will be aggregated using a SUM aggregation, which could explain why you are seeing 2X, 3X etc results. 

Anonymous
Not applicable

Bingo - the results were being aggregated when I dropped it in the table. Thanks!

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