0
0
Power BIbi_tool~10 mins

EARLIER for row context in Power BI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the DAX formula to calculate the difference between the current row's sales and the previous row's sales using EARLIER.

Power BI
Sales Difference = Sales[SalesAmount] - CALCULATE(SUM(Sales[SalesAmount]), FILTER(Sales, Sales[ProductID] = [1]))
Drag options to blanks, or click blank then click option'
ACURRENT(Sales[ProductID])
BSales[ProductID]
CPREVIOUS(Sales[ProductID])
DEARLIER(Sales[ProductID])
Attempts:
3 left
💡 Hint
Common Mistakes
Using Sales[ProductID] directly without EARLIER causes incorrect row context.
Using non-existent functions like PREVIOUS or CURRENT.
2fill in blank
medium

Complete the DAX formula to count how many sales have a higher amount than the current row using EARLIER.

Power BI
Count Higher Sales = COUNTROWS(FILTER(Sales, Sales[SalesAmount] > [1]))
Drag options to blanks, or click blank then click option'
ASales[SalesAmount]
BMAX(Sales[SalesAmount])
CEARLIER(Sales[SalesAmount])
DMIN(Sales[SalesAmount])
Attempts:
3 left
💡 Hint
Common Mistakes
Using Sales[SalesAmount] directly compares the same row to itself, giving wrong results.
Using aggregate functions like MAX or MIN instead of EARLIER.
3fill in blank
hard

Fix the error in the DAX formula that tries to calculate the rank of sales by product using EARLIER.

Power BI
Sales Rank = COUNTROWS(FILTER(Sales, Sales[ProductID] = EARLIER(Sales[ProductID]) && Sales[SalesAmount] > [1])) + 1
Drag options to blanks, or click blank then click option'
AEARLIER(Sales[SalesAmount])
BSales[SalesAmount]
CMAX(Sales[SalesAmount])
DMIN(Sales[SalesAmount])
Attempts:
3 left
💡 Hint
Common Mistakes
Using Sales[SalesAmount] directly causes incorrect row context.
Using aggregate functions like MAX or MIN instead of EARLIER.
4fill in blank
hard

Fill both blanks to calculate the cumulative sales amount per product using EARLIER.

Power BI
Cumulative Sales = CALCULATE(SUM(Sales[SalesAmount]), FILTER(Sales, Sales[ProductID] = [1] && Sales[Date] <= [2]))
Drag options to blanks, or click blank then click option'
AEARLIER(Sales[ProductID])
BSales[Date]
CEARLIER(Sales[Date])
DSales[ProductID]
Attempts:
3 left
💡 Hint
Common Mistakes
Using Sales[ProductID] or Sales[Date] directly without EARLIER.
Mixing EARLIER with non-related columns.
5fill in blank
hard

Fill all three blanks to create a calculated column that flags if the current sale is the highest for its product using EARLIER.

Power BI
Is Highest Sale = IF(Sales[SalesAmount] = CALCULATE(MAX(Sales[SalesAmount]), FILTER(Sales, Sales[ProductID] = [1] && Sales[Date] <= [2] && Sales[Date] >= [3])), TRUE(), FALSE())
Drag options to blanks, or click blank then click option'
AEARLIER(Sales[ProductID])
BEARLIER(Sales[Date])
CSales[Date]
DMAX(Sales[Date])
Attempts:
3 left
💡 Hint
Common Mistakes
Using Sales[ProductID] or Sales[Date] directly without EARLIER.
Using MAX(Sales[Date]) incorrectly inside FILTER.