Power_BI_DAX_Programming_Questions
Power_BI_DAX_Programming_Questions
with Answers
Section: DAX Programming in Power BI (25 Marks)
Q1. What is DAX in Power BI and where is it used?
A1. DAX (Data Analysis Expressions) is a formula language used in Power BI to create calculated
columns, measures, and custom tables. It is used to perform calculations on data models.
Q2. Write a DAX formula to calculate Total Sales from a 'Sales' table.
Q3. How do you calculate the running total of sales using DAX?
A3.
Running Total =
CALCULATE(
SUM(Sales[Amount]),
FILTER(
ALL(Sales[Date]),
Sales[Date] <= MAX(Sales[Date])
)
)
A4.
Previous Month Sales =
CALCULATE(
SUM(Sales[Amount]),
PREVIOUSMONTH(Sales[Date])
)
Q5. Create a DAX measure to calculate Year over Year (YoY) growth.
A5.
YoY Growth =
DIVIDE(
[Total Sales] - CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date'[Date])),
CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date'[Date]))
)
A7. CALCULATE evaluates an expression in a modified filter context. It is used to override or modify
current filters.
A9.
Title =
"Sales Report for " & MAX('Date'[MonthName]) & " " & MAX('Date'[Year])
Q10. Write a DAX expression to calculate a conditional column with three grades based on Sales.
A10.
Sales Grade =
SWITCH(
TRUE(),
Sales[Amount] > 100000, "A",
Sales[Amount] > 50000, "B",
"C"
)