100% found this document useful (1 vote)
2K views5 pages

DAX Practice Problems 55 Questions

The document contains a comprehensive set of 55 DAX practice problems categorized into three sections: Basic DAX Calculations, Time Intelligence Functions, and Advanced DAX & Business Logic. Each question includes a specific calculation or DAX function to solve a business-related problem, providing both the question and the corresponding DAX formula. This resource is designed to enhance understanding and application of DAX in data analysis.

Uploaded by

Sanjay Chopra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
2K views5 pages

DAX Practice Problems 55 Questions

The document contains a comprehensive set of 55 DAX practice problems categorized into three sections: Basic DAX Calculations, Time Intelligence Functions, and Advanced DAX & Business Logic. Each question includes a specific calculation or DAX function to solve a business-related problem, providing both the question and the corresponding DAX formula. This resource is designed to enhance understanding and application of DAX in data analysis.

Uploaded by

Sanjay Chopra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

DAX Practice Problems – Extended Set (55 Questions with Answers)

Section A: Basic DAX Calculations (20 Questions)


1. Q1. Calculate total sales amount.

Total Sales = SUM(Sales[Amount])

2. Q2. Calculate total quantity sold.

Total Quantity = SUM(Sales[Quantity])

3. Q3. Profit = Revenue - Cost.

Profit = Sales[Revenue] - Sales[Cost]

4. Q4. Minimum order amount.

Min Order = MIN(Sales[Amount])

5. Q5. Maximum discount offered.

Max Discount = MAX(Sales[Discount])

6. Q6. Number of distinct customers.

Customer Count = DISTINCTCOUNT(Sales[CustomerID])

7. Q7. Create calculated column: OrderValue = Quantity * Price.

OrderValue = Sales[Quantity] * Sales[UnitPrice]

8. Q8. Create a Boolean column: IsHighValue (> ₹10000)

IsHighValue = Sales[Amount] > 10000

9. Q9. Get earliest order date.

First Order = MIN(Sales[OrderDate])

10. Q10. Get latest order date.

Last Order = MAX(Sales[OrderDate])

11. Q11. Round off sales to 2 decimal places.

Rounded Sales = ROUND(Sales[Amount], 2)

12. Q12. Average sales per order.


Avg Sales = AVERAGEX(VALUES(Sales[OrderID]), [Total Sales])

13. Q13. Add 'High', 'Medium', 'Low' classification.

Sales Tier = SWITCH(TRUE(), Sales[Amount] > 10000, "High", Sales[Amount] > 5000,
"Medium", "Low")

14. Q14. Concatenate year and quarter.

YearQuarter = Sales[Year] & "-Q" & Sales[Quarter]

15. Q15. Apply IF: discount > 0.2 = ‘Heavy Discount’.

DiscountFlag = IF(Sales[Discount] > 0.2, "Heavy Discount", "Normal")

16. Q16. Count rows where quantity > 5.

Big Orders = CALCULATE(COUNTROWS(Sales), Sales[Quantity] > 5)

17. Q17. Days between order and delivery.

DaysToDeliver = DATEDIFF(Sales[OrderDate], Sales[DeliveryDate], DAY)

18. Q18. Show rank of each product by revenue.

Product Rank = RANKX(ALL(Sales[Product]), [Total Sales], , DESC)

19. Q19. Show top 5 cities by revenue.

City Rank = RANKX(ALL(Sales[City]), [Total Sales], , DESC)

20. Q20. Create full name column from FirstName and LastName.

FullName = Sales[FirstName] & " " & Sales[LastName]

Section B: Time Intelligence Functions (15 Questions)


21. Q21. Year-to-date sales.

YTD Sales = TOTALYTD([Total Sales], Sales[OrderDate])

22. Q22. Month-to-date sales.

MTD Sales = TOTALMTD([Total Sales], Sales[OrderDate])

23. Q23. Previous year’s sales.

Sales LY = CALCULATE([Total Sales], SAMEPERIODLASTYEAR(Sales[OrderDate]))

24. Q24. Previous quarter’s sales.

Sales LQ = CALCULATE([Total Sales], PREVIOUSQUARTER(Sales[OrderDate]))


25. Q25. Moving average sales (3 months).

3M Avg = AVERAGEX(DATESINPERIOD(Sales[OrderDate], MAX(Sales[OrderDate]), -3,


MONTH), [Total Sales])

26. Q26. Growth % vs LY.

Growth % = DIVIDE([Total Sales] - [Sales LY], [Sales LY])

27. Q27. Compare current and previous month sales.

Sales Diff = [MTD Sales] - CALCULATE([MTD Sales], PARALLELPERIOD(Sales[OrderDate], -


1, MONTH))

28. Q28. Running total YTD by region.

YTD Region = CALCULATE([Total Sales], FILTER(ALL(Sales[OrderDate]), Sales[OrderDate]


<= MAX(Sales[OrderDate])))

29. Q29. Total orders last 12 months.

Last12M = CALCULATE(COUNT(Sales[OrderID]), DATESINPERIOD(Sales[OrderDate],


MAX(Sales[OrderDate]), -12, MONTH))

30. Q30. Rolling 6 months average revenue.

Rolling6M = AVERAGEX(DATESINPERIOD(Sales[OrderDate], MAX(Sales[OrderDate]), -6,


MONTH), [Total Sales])

31. Q31. Show fiscal year from calendar date.

Fiscal Year = IF(MONTH(Sales[OrderDate]) >= 4, YEAR(Sales[OrderDate]),


YEAR(Sales[OrderDate]) - 1)

32. Q32. Current quarter name.

Quarter = "Q" & ROUNDUP(MONTH(Sales[OrderDate])/3, 0)

33. Q33. Count of new customers this year.

NewCustomers = CALCULATE(COUNTROWS(Customers), FILTER(Customers,


YEAR(Customers[FirstOrderDate]) = YEAR(TODAY())))

34. Q34. Get week number from date.

WeekNum = WEEKNUM(Sales[OrderDate])

35. Q35. Days in month for given date.

DaysInMonth = DAY(EOMONTH(Sales[OrderDate], 0))


Section C: Advanced DAX & Business Logic (20 Questions)
36. Q36. Identify returning customers.

Returning = IF(CALCULATE(COUNTROWS(Sales), FILTER(Sales, Sales[CustomerID] =


EARLIER(Sales[CustomerID]) && Sales[OrderDate] < EARLIER(Sales[OrderDate]))) > 0,
"Yes", "No")

37. Q37. Show rank by customer loyalty points.

Loyalty Rank = RANKX(ALL(Customers), [Total Points], , DESC)

38. Q38. Calculate order frequency per customer.

OrderFreq = DIVIDE(COUNT(Sales[OrderID]), DISTINCTCOUNT(Sales[CustomerID]))

39. Q39. Identify inactive customers (no orders in last 6 months).

Inactive = NOT Sales[CustomerID] IN VALUES(RecentOrders[CustomerID])

40. Q40. Top 3 products per category.

Top3 = IF(RANKX(FILTER(Sales, Sales[Category] = EARLIER(Sales[Category])), [Total


Sales], , DESC) <= 3, 1, 0)

41. Q41. Segment customers by revenue into Gold, Silver, Bronze.

Segment = SWITCH(TRUE(), [Total Sales] > 100000, "Gold", [Total Sales] > 50000, "Silver",
"Bronze")

42. Q42. Create dynamic title using SELECTEDVALUE.

Title = "Sales Overview - " & SELECTEDVALUE(Calendar[Year])

43. Q43. Show product with highest revenue per category.

TopProduct = CALCULATE(MAX(Sales[Amount]), ALLEXCEPT(Sales, Sales[Category]))

44. Q44. Compare revenue of region vs national average.

Region vs Avg = [Total Sales] - CALCULATE(AVERAGE(Sales[Amount]), ALL(Sales))

45. Q45. Create KPI flag: Green if YoY > 10%, Red if < 5%.

KPI_Flag = SWITCH(TRUE(), [Growth %] > 0.1, "Green", [Growth %] < 0.05, "Red", "Yellow")

46. Q46. Show count of unique orders where discount was applied.

Discount Orders = CALCULATE(DISTINCTCOUNT(Sales[OrderID]), Sales[Discount] > 0)

47. Q47. Detect duplicates in Customer table.


DuplicateCheck = COUNTROWS(FILTER(Customers, Customers[Email] =
EARLIER(Customers[Email]))) > 1

48. Q48. Create a calculated column: Margin %.

Margin % = DIVIDE(Sales[Profit], Sales[Revenue])

49. Q49. Identify most profitable product.

MostProfitProduct = TOPN(1, SUMMARIZE(Sales, Sales[Product], "Profit",


SUM(Sales[Profit])), [Profit], DESC)

50. Q50. Calculate category-wise sales share.

Category Share = DIVIDE([Total Sales], CALCULATE([Total Sales], ALL(Sales[Category])))

51. Q51. Show top performing region by quarter.

TopRegion = RANKX(ALL(Sales[Region]), [Quarter Sales], , DESC)

52. Q52. Show sales per working day only.

Working Day Sales = CALCULATE([Total Sales], Calendar[IsWorkingDay] = TRUE())

53. Q53. Create an alert for orders with negative profit.

NegativeProfit = IF(Sales[Profit] < 0, "Alert", "OK")

54. Q54. Get median sales by category.

Median Sales = MEDIANX(FILTER(Sales, Sales[Category] = EARLIER(Sales[Category])),


Sales[Amount])

55. Q55. Rank all cities by profit margin.

City Margin Rank = RANKX(ALL(Sales[City]), [Margin %], , DESC)

You might also like