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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
possible-possum
Frequent Visitor

Calculated columns in DAX vs computed columns in Power Query

I have a couple of date comparison calculations I need to perform in Power BI. Both are very straight forward, but I was wondering what the most efficient way would be to do them.

 

I need a new column in two different tables, which provides a number of months between two dates. I require the column so that I can use it as a row/axis input into visuals in my report. 

 

In one instance, both the date columns are contained within one table. In the other instance, the date columns are in different tables but can be easily accessed through the RELATED function.

 

There are around 80,000 rows in each table I need these columns. In each of these instances, would you use a DATEDIFF function, or would you complete the steps in Power Query instead (including the merge in the second instance)?

 

My data model is not overly large (around 85mb) but my refresh times are beginning to get a bit long (not related to these two tables though), so I am hoping to avoid as many expensive Power Query steps as possible! The new columns will have very low cardinality (a numeric number between -1 and 12) so data model size is not too much of a concern. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @possible-possum ,

 

In general, choosing between calculated columns in DAX and calculated columns in Power Query depends on a number of factors, and here are some considerations for both approaches:

  • Calculated columns in DAX:
    Performance: Calculated columns in DAX are computed in the row context of the query, and they can affect query performance. However, for simple calculations, such as the number of months between two dates, the impact is usually negligible.
  • Calculated columns in Power Query:
    Performance: Calculated columns in Power Query are applied during the data loading process and have the potential to improve query performance. These steps are performed in the M language and may be more efficient for some operations.


In your scenario, using calculated columns in DAX is straightforward if the dates are in the same table or if associations can be easily established. You can evaluate the performance impact and adjust your approach based on test results.

 

For more details, you can read below blog:

Comparing DAX calculated columns with Power Query computed columns - SQLBI

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @possible-possum ,

 

In general, choosing between calculated columns in DAX and calculated columns in Power Query depends on a number of factors, and here are some considerations for both approaches:

  • Calculated columns in DAX:
    Performance: Calculated columns in DAX are computed in the row context of the query, and they can affect query performance. However, for simple calculations, such as the number of months between two dates, the impact is usually negligible.
  • Calculated columns in Power Query:
    Performance: Calculated columns in Power Query are applied during the data loading process and have the potential to improve query performance. These steps are performed in the M language and may be more efficient for some operations.


In your scenario, using calculated columns in DAX is straightforward if the dates are in the same table or if associations can be easily established. You can evaluate the performance impact and adjust your approach based on test results.

 

For more details, you can read below blog:

Comparing DAX calculated columns with Power Query computed columns - SQLBI

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.