Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi everyone. I have a bit of an odd request... I have already worked out a solution! The question is: Is there a better way? My solution is taking too much time to calculate. I made a sample workbook that presents the solution I worked out. If there are any "Super PQ Authors" out there I would appreaceate a review and suggestions for how to improve the modle.
The situation in a nutshell:
Link to workbook:
https://1drv.ms/x/s!BPxG8sbQyKTUl1xi1a5NCUvPQSuV?e=lPrZa2
Thanks for any assistance!
John
Solved! Go to Solution.
Hi John,
hats off for this excellent workbook with sample data.
There are a couple of things you can do, which should all find on my Performance page here: https://www.thebiccountant.com/speedperformance-aspects/
What's not included in that list is a new way to speed up nested if-then-elses (I've implemented that in step "AddField_StepStartDate", but you might want to adjust other steps as well):
Record.FieldOrDefault(
[ 1 = [Start Date],
2 = Date.AddDays([Step1 Finish],1),
3 = Date.AddDays([Step2 Finish],1)
],
Text.From([Step]),
null)
This is a variation of the CASE-technique I've used here: https://www.thebiccountant.com/2017/12/11/date-datesbetween-retrieve-dates-between-2-dates-power-bi-...
It makes sure that the expression is evaluated lazily: So only one of the possible cases will be evaluated.
In addition to that, it could be that my Date.Networkdays-function is faster than yours: https://www.thebiccountant.com/2020/02/20/date-networkdays-function-for-power-query-and-power-bi/ (but I haven't tested it)
Attaching the file with some adjustments.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @JohnThomas
Of the Super PQ Users, @ImkeF is the superest I know!
Greg - I got your book! Great content - I'm learning so much! (You need a different editor however... several typos. Nothing that takes away from the DAX code or the solutions however.)
Cheers!
Hi John,
hats off for this excellent workbook with sample data.
There are a couple of things you can do, which should all find on my Performance page here: https://www.thebiccountant.com/speedperformance-aspects/
What's not included in that list is a new way to speed up nested if-then-elses (I've implemented that in step "AddField_StepStartDate", but you might want to adjust other steps as well):
Record.FieldOrDefault(
[ 1 = [Start Date],
2 = Date.AddDays([Step1 Finish],1),
3 = Date.AddDays([Step2 Finish],1)
],
Text.From([Step]),
null)
This is a variation of the CASE-technique I've used here: https://www.thebiccountant.com/2017/12/11/date-datesbetween-retrieve-dates-between-2-dates-power-bi-...
It makes sure that the expression is evaluated lazily: So only one of the possible cases will be evaluated.
In addition to that, it could be that my Date.Networkdays-function is faster than yours: https://www.thebiccountant.com/2020/02/20/date-networkdays-function-for-power-query-and-power-bi/ (but I haven't tested it)
Attaching the file with some adjustments.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Imke,
Thanks so much for taking the time to look at this for me and my appologies for taking so long to get back to you. For some reason email notifications for this thread were not getting to me!
Anyway, I am reading all the links you provided and going through the updated workbook.
Thanks again!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.