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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
campelliann
Post Patron
Post Patron

If condition vs merge (which is better for performance)

Hi,

 

I have a very simple thing to do on Powerquery which is basically for each month of the Year to write a "weighted" working days. And I just added a custom column like below. But is this a "Best practice" or would it be better performance wise to just create a table with the months name/weighted days and then merge with with main table?

Thanks

= Table.AddColumn(#"Filtered Rows", "Custom", each if Date.Month([Month]) =1 then 19.5 else if Date.Month([Month]) =2 or Date.Month([Month]) =4 or Date.Month([Month]) =7 or Date.Month([Month]) =12 then 17.5 else if Date.Month([Month]) =5 then 21.5 else if Date.Month([Month]) =6 then 16.5 else if Date.Month([Month]) =8 then 15.5 else if Date.Month([Month]) =3 or Date.Month([Month]) =11 then 20.5 else if Date.Month([Month]) =10 then 18.5 else 0)

1 ACCEPTED SOLUTION
daXtreme
Solution Sage
Solution Sage

I don't think there is something like Best Practices in Power Query. If you have several ways to do things, you have to test. This is general in programming, even though some languages do have something like Best Practices (for instance, Python, but even there you have to test different approaches).

View solution in original post

1 REPLY 1
daXtreme
Solution Sage
Solution Sage

I don't think there is something like Best Practices in Power Query. If you have several ways to do things, you have to test. This is general in programming, even though some languages do have something like Best Practices (for instance, Python, but even there you have to test different approaches).

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors