Displaying All Rows in Power BI Python Visuals

DP-600 By islever Editorial Last updated

Short answer

C Add a unique field to each row to ensure Power BI treats every row as distinct and displays all data without grouping.

Question

You have a Fabric tenant that contains a Microsoft Power BI report named Report1. Report1 includes a Python visual. Data displayed by the visual is grouped automatically and duplicate rows are NOT displayed. You need all rows to appear in the visual. What should you do?
  1. Reference the columns in the Python code by index.
  2. Modify the Sort Column By property for all columns.
  3. Add a unique field to each row. Correct Answer
  4. Modify the Summarize By property for all columns.

Key Takeaways

The question tests the specific workaround for Power BI's default aggregation behavior in Python visuals: adding an index field to make rows distinct.

This page explains how to prevent automatic grouping in Power BI Python visuals by adding a unique identifier field, ensuring all rows including duplicates are displayed.

Common mistake: Candidates often choose Option A (referencing columns by index), confusing Pandas coding syntax with the dataset preparation requirement described in Microsoft documentation.

Expert Analysis

Why the Answer Is Correct

Power BI automatically groups data and removes duplicate rows in Python visuals to optimize performance. To display every row exactly as it exists in the source, including duplicates, you must add a unique field (such as an auto-incrementing index) to the dataset. This forces Power BI to treat each row as distinct, thereby disabling the automatic grouping mechanism.

Why the Other Options Are Wrong

Option A is incorrect because referencing columns by index in Python code (e.g., using iloc) does not change how Power BI aggregates or groups the input data before passing it to the script. Option B involves sorting, which has no effect on duplication or grouping. Option D suggests modifying 'Summarize By' to None, but this property is generally not available or effective for forcing raw row display in Python visuals compared to the documented index solution.

Community Comment Notes

The community consensus strongly supports Option C, citing Microsoft Learn documentation that explicitly states adding an index field prevents grouping. Several users initially considered Option A due to the word 'index,' but clarified that Option A refers to internal Python coding syntax rather than dataset structure. Comments emphasize that the key is making rows unique in the dataset, not manipulating the Python code itself.

Official Reference

https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-visuals

This link opens the official vendor documentation in a new tab.

Exam Strategy

When dealing with Python visuals in Power BI exams, remember that data preprocessing happens at the dataset level. If the goal is to bypass default aggregation or grouping, look for options involving unique identifiers or indices added to the data model.

Frequently Asked Questions

Why doesn't changing Summarize By to None work?

In Python visuals, the primary method to disable grouping is ensuring row uniqueness via an index field, as the Summarize By property is less reliable for this specific visual type.

What is the difference between Option A and Option C?

Option A refers to Python coding syntax (iloc), while Option C refers to adding a column to the underlying dataset to force distinctness before the script runs.

More DP-600 FAQ →

Community Votes

C
53%
A
27%
D
20%

53% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.

Discussion 45 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 30 of 45

  1. TashaP 👍 64
    A - often the Microsoft learn pages give you the exact answer: Under tips on the link I posted: In some cases, you might not want automatic grouping to occur, or you might want all rows to appear, including duplicates. In those cases, you can add an index field to your dataset that causes all rows to be considered unique and prevents grouping. https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-visuals There are always multiple approaches in application but if you do the MS exam give the MS answer.
  2. Fermd 👍 13 Answered D
    The right answer is D: By setting the "Summarize By" property to "None" for all columns, you disable automatic aggregation and ensure all rows, including duplicates, are displayed in the Python visual.
  3. [Removed] 👍 8 Answered C
    I think people are misunderstanding what option A is saying. The option says to reference columns INSIDE the Python code by index, which does not help. That means writing df.iloc[:, columnIndex] instead of df[columnName], see Pandas documentation for more on this: https://pandas.pydata.org/docs/user_guide/indexing.html The Microsoft learn article that's referenced several times in these comments clearly says that you need to add a column that's unique to all rows which "causes all rows to be considered unique and prevents grouping" -- this is what option C means.
  4. semauni 👍 7 Answered C
    "In some cases, you might not want automatic grouping to occur, or you might want all rows to appear, including duplicates. In those cases, you can add an index field to your dataset that causes all rows to be considered unique and prevents grouping." I was leaning towards A because of the word 'index', and usually if a specific term is mentioned, Microsoft wants to hear you use that term. But option A talks about REFERENCING the index in the CODE. The quote above is not about how you write your code (like cgroven mentioned, e.g. df["streetName"] vs. df[1] for example), but it is about how you should modify your data structure and visual to handle the results. If you read the above statement with this distinction in mind, then it clearly reads C.
  5. a_51 👍 6 Answered C
    C - some are saying A for the same link, but A is not saying to add something like a row_number which I think C is saying. https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-visuals In some cases, you might not want automatic grouping to occur, or you might want all rows to appear, including duplicates. In those cases, you can add an index field to your dataset that causes all rows to be considered unique and prevents grouping.
Show 25 more comments
  1. stilferx 👍 5 Answered C
    IMHO, the answer is C - add unique value (index). It can be found here: https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-visuals It says: In some cases, you might not want automatic grouping to occur, or you might want all rows to appear, including duplicates. In those cases, you can add an index field to your dataset that causes all rows to be considered unique and prevents grouping.
  2. estrelle2008 👍 4 Answered A
    Question is focussed on a Python visual, so READ the link that Tasha posted. As it explicit says about a Python visual in PBI: a) The default aggregation is Don't summarize. Similar to table visuals, fields are grouped and duplicate rows appear only once. b) In some cases, you might not want automatic grouping to occur, or you might want all rows to appear, including duplicates. In those cases, you can add an index field to your dataset that causes all rows to be considered unique and prevents grouping.
  3. Azure_2023 👍 4 Answered C
    C. Add a unique field to each row. By adding a unique field to each row, you ensure that Power BI treats each row as distinct. This can be achieved by incorporating a column that contains unique values for each row (e.g., a row number or a unique identifier). When this unique field is included in the dataset used by the Python visual, Power BI will not aggregate the rows because it recognizes each one as different due to the unique identifier.
  4. Naqib 👍 4
    A Quoted from https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-visuals: "In some cases, you might not want automatic grouping to occur, or you might want all rows to appear, including duplicates. In those cases, you can add an index field to your dataset that causes all rows to be considered unique and prevents grouping."
  5. wellingtonluis 👍 4 Answered C
    If you truly want to have individual rows passed into your visual, you'll need to add unique value to each row of your dataset (such as an auto-incrementing int) to prevent grouping
  6. vish9 👍 3 Answered C
    If we refer to the following link: https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-visuals We see the following text: Based on your selections, the Python script editor generates the following binding code. The editor creates a dataset dataframe with the fields you add. The default aggregation is Don't summarize. Similar to table visuals, fields are grouped and duplicate rows appear only once. In some cases, you might not want automatic grouping to occur, or you might want all rows to appear, including duplicates. In those cases, you can add an index field to your dataset that causes all rows to be considered unique and prevents grouping. You can infer from this that you need to add a unique field for each row. That will make it C
  7. Araujoleo44 👍 3 Answered C
    C - Pois Se o visual Python estiver agrupando automaticamente os dados e excluindo linhas duplicadas, isso pode indicar que o código Python associado ao visual está realizando algum tipo de agregação ou sumarização dos dados antes de exibi-los. Para garantir que todas as linhas apareçam no visual, você pode precisar ajustar o código Python para que ele não realize essa agregação ou sumarização. Por exemplo, se o código Python estiver usando a função groupby para agrupar os dados, você pode precisar remover ou modificar essa parte do código. Certifique-se de revisar o código Python associado ao visual e ajustá-lo conforme necessário para garantir que todas as linhas sejam exibidas.
  8. sraakesh95 👍 3
    C - Add a unique (index field) to the dataset As TashaP mentioned, it has been mentioned under the Tips section in this link: https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-visuals However, the answer should be C
  9. cafb698 👍 3 Answered A
    As much as C is tempting, let's focus on the wording. "Add a unique field to each row". You simply say, "Add another column for unique id" or something like that. In terms of Microsoft ways of asking, it's A.
  10. rmeng 👍 3 Answered C
    C (“Add a unique field to each row”) is the correct approach. By adding an index column, you’ll ensure that all rows appear in your Python visual.
  11. Plb2 👍 3 Answered A
    as clearly stated here https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-visuals
  12. Training_ND 👍 3 Answered A
    MS ANSWER. https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-visuals
  13. thuss 👍 3 Answered A
    A, see TashaP's answer. (Just commenting as well as to not have a misleading vote!)
  14. SilvanoRamalho 👍 2 Answered A
    https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-visuals --- Respostas "A"... da MS... Em alguns casos, talvez você não queira que o agrupamento automático ocorra ou queira que todas as linhas apareçam, inclusive as duplicadas. Nesses casos, você pode adicionar um campo de índice ao seu conjunto de dados que faz com que todas as linhas sejam consideradas exclusivas e evita o agrupamento.
  15. ziggy1117 👍 2 Answered C
    ANSWER IS C: In some cases, you might not want automatic grouping to occur, or you might want all rows to appear, including duplicates. In those cases, you can add an index field to your dataset that causes all rows to be considered unique and prevents grouping. This means you need to add an index field column in which case each row will have a unique index value per row
  16. fits08pistils 👍 2
    It seems not everyone can read and understand documentation. The following Python script is execute EVERY TIME you use a Python visual: dataset = pandas.DataFrame(column1, column2, ...) dataset = dataset.drop_duplicates() So the ONLY way to prevent the duplicates from being dropped is to have a unique identifier. Ergo, option C is the only possible answer here.
  17. VAzureD 👍 2 Answered A
    Read the link that TashaP gave. https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-visuals "In some cases, you might not want automatic grouping to occur, or you might want all rows to appear, including duplicates. In those cases, you can add an index field to your dataset that causes all rows to be considered unique and prevents grouping "
  18. nasra2 👍 2
    A: https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-visuals In some cases, you might not want automatic grouping to occur, or you might want all rows to appear, including duplicates. In those cases, you can add an index field to your dataset that causes all rows to be considered unique and prevents grouping.
  19. ZSteward 👍 2
    The default aggregation is Don't summarize. so no need for etting the "Summarize By" property to "None" for all columns , C is correct Answer
  20. Danialmellfoye 👍 2 Answered D
    Simply right-click the column in visualization pane and choose "Don't summarize" option
  21. PCCCCCC 👍 2 Answered A
    https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-visuals
  22. manolet 👍 2 Answered C
    C regarding to the links provided in previous comments
  23. Sowwy1 👍 2
    I think it's C. Add a unique field to each row.
  24. BennyBenz 👍 2 Answered A
    You want to do something impacting the visual.
  25. Momoanwar 👍 2 Answered D
    Juste disable summurize in column on visual

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Practice All DP-600 Questions

Access 115 questions with complete answers and detailed explanations.

View Full DP-600 Practice Test →

← Back to DP-600 Study Guide