๐ Power BI Interview Challenge #1 ๐ฅ
๐๐ป๐๐ฒ๐ฟ๐๐ถ๐ฒ๐๐ฒ๐ฟ:
You have 2 minutes to solve this Power BI problem.
You have a Sales table with the following columns:
Order Date
Sales
Create a DAX measure to calculate Year-to-Date (YTD) Sales.
๐ ๐ฒ: Challenge accepted! ๐ช
YTD Sales =
TOTALYTD(
SUM(Sales[Sales]),
Sales[Order Date]
)
๐ก Explanation:
TOTALYTD() calculates the cumulative sales from the beginning of the year up to the current date.
โข SUM(Sales) returns the total sales amount
โข Sales[Order Date] is the date column used for the YTD calculation
โข The measure automatically resets at the start of each new year[Sales]
๐ฏ Expected Output Example
Month | Sales | YTD Sales
--- | --- | ---
Jan | 10,000 | 10,000
Feb | 15,000 | 25,000
Mar | 12,000 | 37,000
Apr | 18,000 | 55,000
๐ Bonus (Using a Calendar Table)
YTD Sales =
TOTALYTD(
[Total Sales],
'Calendar'[Date]
)
Using a dedicated Calendar/Date table is considered a Power BI best practice and is recommended for all time intelligence calculations.
๐ Tip for Power BI Job Seekers:
Time Intelligence is one of the most frequently tested topics in Power BI interviews. Make sure you can confidently write measures for:
โข YTD (Year-to-Date)
โข MTD (Month-to-Date)
โข QTD (Quarter-to-Date)
โข Previous Year Sales
โข YoY Growth %
โข Rolling 12 Months
These are commonly used in business dashboards and technical interviews.
Power BI Resources: https://whatsapp.com/channel/0029Vai1xKf1dAvuk6s1v22c
โค๏ธ React with โค๏ธ for more Power BI interview challenges!
Post #2952
7.58K
- โค 16