TGViewer
Data Analytics Data Analytics @sqlspecialist ยท 111K subscribers
Post #2957 6.13K
๐Ÿš€ Power BI Interview Challenge #3 ๐Ÿ”ฅ

๐—œ๐—ป๐˜๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„๐—ฒ๐—ฟ:
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-over-Year (YoY) Sales Growth %.

๐— ๐—ฒ: Challenge accepted! ๐Ÿ’ช

YoY Growth % =
VAR CurrentYearSales = [Total Sales]
VAR PreviousYearSales =
CALCULATE(
[Total Sales],
SAMEPERIODLASTYEAR('Calendar'[Date])
)
RETURN
DIVIDE(
CurrentYearSales - PreviousYearSales,
PreviousYearSales,
0
)


๐Ÿ’ก Explanation:

This measure calculates the percentage growth in sales compared to the same period in the previous year.

โ€ข CurrentYearSales stores the current period's sales.
โ€ข SAMEPERIODLASTYEAR() retrieves sales for the same period last year.
โ€ข DIVIDE() safely calculates the percentage growth and avoids divide-by-zero errors.

This challenge tests your understanding of:
โœ… Variables (VAR)
โœ… CALCULATE()
โœ… SAMEPERIODLASTYEAR()
โœ… DIVIDE()
โœ… Time Intelligence

๐ŸŽฏ Expected Output Example

For Year 2025: Sales = 120,000, Previous Year Sales = 100,000, YoY Growth % = 20%
For Year 2026: Sales = 150,000, Previous Year Sales = 120,000, YoY Growth % = 25%

๐Ÿš€ Bonus (YoY Sales Difference)

YoY Sales Difference =
[Total Sales] -
CALCULATE(
[Total Sales],
SAMEPERIODLASTYEAR('Calendar'[Date])
)


This measure returns the absolute increase or decrease in sales compared to the previous year.

๐Ÿš€ Tip for Power BI Job Seekers:

CALCULATE() is the most important DAX function. Learn how it modifies the filter context because it's used in almost every advanced Power BI interview question.

Power BI Resources: https://whatsapp.com/channel/0029Vai1xKf1dAvuk6s1v22c

โค๏ธ React with โค๏ธ for more Power BI interview challenges!
  • โค 12
More from @sqlspecialist
  1. Oct 7, 2026๐Ÿ“Š Kandinsky 6.0 Video: AI-Powered Content Creation for Analysts The new Kandinsky 6.0 Vidโ€ฆ
  2. Oct 7, 2026Alternatively, depending on the Excel version and requirement, I could use functions suchโ€ฆ
  3. Oct 7, 2026๐Ÿ“Š Data Analyst Interview Series โ€” Part 5 Guys, let's continue our Data Analyst Interviewโ€ฆ
  4. Oct 7, 2026๐Ÿš€๐—ฃ๐—ฎ๐˜† ๐—”๐—ณ๐˜๐—ฒ๐—ฟ ๐—ฃ๐—น๐—ฎ๐—ฐ๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐—ง๐—ฟ๐—ฎ๐—ถ๐—ป๐—ถ๐—ป๐—ด | ๐—•๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฒ ๐—ฎ ๐—™๐˜‚๐—น๐—น๐˜€๐˜๐—ฎ๐—ฐโ€ฆ
  5. Oct 7, 2026๐Ÿ”Ÿ What is the difference between UNION and JOIN? Sample Answer: "JOIN combines columns frโ€ฆ
  6. Oct 7, 2026๐Ÿ“Š Data Analyst Interview Series โ€” Part 4 Guys, let's continue our Data Analyst Interviewโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’