0
0
Power BIbi_tool~20 mins

Sorting data in Power BI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Sorting Data Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
dax_lod_result
intermediate
2:00remaining
Sorting Sales by Month Name in Calendar Order

You have a table with sales data and a column 'MonthName' containing month names as text (e.g., January, February). You want to create a measure that returns total sales sorted by calendar month order, not alphabetically.

Which DAX expression correctly creates a calculated column to sort 'MonthName' in calendar order?

AMonthSort = RANKX(ALL('Calendar'[MonthName]), [MonthName], , ASC)
BMonthSort = MONTH(DATEVALUE([MonthName] & " 1"))
CMonthSort = IF([MonthName] = "January", 1, IF([MonthName] = "February", 2, IF([MonthName] = "March", 3, 0)))
DMonthSort = SWITCH([MonthName], "January", 1, "February", 2, "March", 3, "April", 4, "May", 5, "June", 6, "July", 7, "August", 8, "September", 9, "October", 10, "November", 11, "December", 12, 0)
Attempts:
2 left
💡 Hint

Think about assigning a number to each month name to represent its calendar order.

visualization
intermediate
1:30remaining
Sorting a Bar Chart by Total Sales Descending

You created a bar chart showing total sales by product category. By default, the categories are sorted alphabetically. How do you sort the bars from highest to lowest total sales?

Choose the correct step to achieve this in Power BI.

AClick the vertical axis, then select 'Sort by' > 'Total Sales' and choose 'Descending'.
BChange the data type of the category column to numeric to enable sorting by sales.
CCreate a new calculated column with sales rank and sort the category by this column.
DSort the data table in Excel before importing to Power BI.
Attempts:
2 left
💡 Hint

Look for sorting options directly on the visual's axis or fields.

data_modeling
advanced
2:00remaining
Sorting a Text Column by Another Column in Power BI Model

You have a 'Product' table with a 'Category' column (text) and a 'CategorySortOrder' column (number). You want the 'Category' column to be sorted by 'CategorySortOrder' in all visuals.

What is the correct way to set this up in Power BI?

ARename 'CategorySortOrder' to 'Category' to replace the original column.
BCreate a measure that returns 'CategorySortOrder' and use it to sort 'Category'.
CSelect the 'Category' column in the model, then use 'Sort by Column' and choose 'CategorySortOrder'.
DSort the 'Category' column alphabetically and ignore 'CategorySortOrder'.
Attempts:
2 left
💡 Hint

Power BI allows sorting one column by another column in the data model.

🔧 Formula Fix
advanced
2:00remaining
Debugging Incorrect Sorting of Weekday Names

You created a calculated column 'WeekdaySort' to sort weekday names in calendar order, but the sorting is incorrect in your report.

Here is the DAX code you wrote:

WeekdaySort = SWITCH([WeekdayName], "Monday", 1, "Tuesday", 2, "Wednesday", 3, "Thursday", 4, "Friday", 5, "Saturday", 6)

Why is the sorting wrong?

AThe SWITCH function syntax is incorrect and causes a syntax error.
BThe SWITCH statement is missing the 'Sunday' case, so Sunday returns BLANK() and sorts first.
CWeekday names must be numbers, not text, to sort correctly.
DThe calculated column must use IF instead of SWITCH for sorting.
Attempts:
2 left
💡 Hint

Check if all possible weekday names are covered in the SWITCH statement.

🧠 Conceptual
expert
2:30remaining
Understanding Sorting Behavior with Multiple Sort Columns

In Power BI, you want to sort a table visual by two columns: first by 'Region' alphabetically, then by 'Sales' descending within each region.

Which statement best describes how to achieve this sorting?

ASort the visual first by 'Region' ascending, then hold Ctrl and sort by 'Sales' descending to apply multi-level sorting.
BPower BI does not support multi-column sorting in visuals; you must sort by one column only.
CCreate a new calculated column combining 'Region' and 'Sales' and sort by that column.
DSort the data source table externally before importing to Power BI.
Attempts:
2 left
💡 Hint

Try using Ctrl key to add multiple sort levels in the visual.