Sample Data
Sales data for three products with their sales amounts.
| Cell | Value |
|---|---|
| A1 | Product |
| B1 | Sales |
| A2 | Apple |
| B2 | 100 |
| A3 | Banana |
| B3 | 150 |
| A4 | Cherry |
| B4 | 200 |
Sales data for three products with their sales amounts.
| Cell | Value |
|---|---|
| A1 | Product |
| B1 | Sales |
| A2 | Apple |
| B2 | 100 |
| A3 | Banana |
| B3 | 150 |
| A4 | Cherry |
| B4 | 200 |
SUMX(FILTER('Table', 'Table'[Sales] > 100), 'Table'[Sales])A B 1 Product Sales 2 Apple 100 3 Banana 150 <-- Filtered in 4 Cherry 200 <-- Filtered in
A B C 1 Product Sales Result 2 Apple 100 3 Banana 150 4 Cherry 200 350
What is a simple way to improve the performance of a DAX query in Power BI?
SUM(Sales[Amount]) is slow. What should you do?
SUM(Sales[Amount]) can reduce repeated scans and improve speed.Which of the following is the correct syntax to define a variable in a DAX measure?
Measure = ?VAR to declare variables and RETURN to output the result.VAR Total = SUM(Sales[Amount]) RETURN Total.Consider this DAX measure:
Measure =
VAR FilteredSales = FILTER(Sales, Sales[Region] = "West")
RETURN SUMX(FilteredSales, Sales[Amount])What is the main performance issue with this measure?
Identify the error in this DAX measure that aims to optimize performance:
Measure =
VAR TotalSales = SUM(Sales[Amount])
RETURN
CALCULATE(TotalSales, FILTER(Sales, Sales[Region] = "East"))You want to optimize a DAX measure that calculates total sales for the current year only. Which approach is best for performance?
Option 1:
Measure = CALCULATE(SUM(Sales[Amount]), FILTER(Sales, YEAR(Sales[Date]) = YEAR(TODAY())))
Option 2:
Measure = CALCULATE(SUM(Sales[Amount]), Sales[Date].[Year] = YEAR(TODAY()))Pass the test and this pattern moves unknown