Bird
0
0

Which of these is the correct M code snippet to pivot a column named 'Month' with values from 'Sales'?

easy📝 Conceptual Q3 of 15
Power BI - Data Cleaning with Power Query
Which of these is the correct M code snippet to pivot a column named 'Month' with values from 'Sales'?
ATable.Pivot(Source, List.Distinct(Source[Month]), "Month", "Sales", List.Sum)
BTable.Pivot(Source, List.Distinct(Source[Month]), "Month", "Sales")
CTable.Pivot(Source, "Month", "Sales")
DTable.Pivot(Source, "Sales", "Month")
Step-by-Step Solution
Solution:
  1. Step 1: Understand Table.Pivot syntax

    Table.Pivot requires source, list of pivot values, pivot column, value column, and aggregation function.
  2. Step 2: Identify correct parameters

    Table.Pivot(Source, List.Distinct(Source[Month]), "Month", "Sales", List.Sum) correctly uses List.Distinct(Source[Month]) and List.Sum aggregation.
  3. Final Answer:

    Table.Pivot(Source, List.Distinct(Source[Month]), "Month", "Sales", List.Sum) -> Option A
  4. Quick Check:

    M pivot syntax = Table.Pivot(Source, List.Distinct(Source[Month]), "Month", "Sales", List.Sum) [OK]
Quick Trick: Pivot needs aggregation function in M code [OK]
Common Mistakes:
  • Omitting aggregation function
  • Swapping pivot and value columns
  • Using incorrect List.Distinct syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Power BI Quizzes