Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
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.
Solved! Go to Solution.
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:
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.
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:
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.
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
16 | |
10 | |
8 | |
8 | |
7 |