
Answer-first summary for fast verification
Answer: Duration.Days
The question requires calculating the number of days between two date columns (Order_Date and Shipping_Date). The optimal approach is to first subtract the dates to get a duration value, then extract the number of days from that duration. Duration.Days is specifically designed to extract the day component from a duration value, making it the correct choice. DateTime.LocalNow (A) returns the current date/time, not a calculation between columns. Duration.From (C) creates a duration from components, not extracts days from an existing duration. Date.AddDays (D) adds days to a date, rather than calculating the difference between dates. The community discussion shows 100% consensus on option B, with examples demonstrating Duration.Days(#duration(5, 12, 30, 0)) returning 5 days, confirming it extracts just the day component from duration values.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You have a query in Microsoft Power BI Desktop with two columns named Order_Date and Shipping_Date.
You need to create a new column that calculates the number of days between Order_Date and Shipping_Date for each row.
Which Power Query M function should you use?
A
DateTime.LocalNow
B
Duration.Days
C
Duration.From
D
Date.AddDays
No comments yet.