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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Dunner2020
Post Prodigy
Post Prodigy

Average difference date value is different in power BI

Hi there,

 

My sample data is present in this link: https://1drv.ms/x/s!AucycxZHFe9TjTF2d36VklLNs7UN?e=gOenxH . I am trying to calculate the average difference between the installationdate column present in the file and today(). Here is my code for calculating:

 

Average conductor life = CALCULATE(
AVERAGEX(conduction_info,DATEDIFF(conduction_info[INSTALLATIONDATE],TODAY(),YEAR)),
FILTER(conduction_info,conduction_info[TYPE]="OH")
)
 
Above formula give me 40 as the result. However, when I calculate the average difference on excel, it gives 45. Could anyone please guide me where am I making the mistake?
4 REPLIES 4
Anonymous
Not applicable

Hi @Dunner2020,

Did these reply help with your scenario?
If this is a case, you can accept the most suitable one as a solution to help other users who faced the same issue. If not, please feel free to post here with detailed information.

How to Get Your Question Answered Quickly 
Regards,

Xiaoxin Sheng

Ashish_Mathur
Super User
Super User

Hi,

In cell D2, enter this formula and copy down

=DATEDIF(A2,TODAY(),"y")

Now if you average this column, the result is 40.  So your DAX formulas is returning the correct result.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
mahoneypat
Microsoft Employee
Microsoft Employee

Your 40 result looks correct to me in both PBI and Excel.  What formula are you using in Excel?

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


@mahoneypat ,

 

That's wired. I use the following approach.

First I create new column using following formula.

=DATEDIF(A2,TODAY(),"Y")

Then I calculate the average using Average() function to calculate the average value of new column. 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.