Forum Discussion

Winter_king94's avatar
1 year ago
Solved

Group By in Power Query

Hello,

 

I am working a data set that is too large to load into Power BI. To limit the data I am trying to group by.

My problem is that when I group by, not all the unique email names are being brought through. I have validated that all my necessary rows are shown in the step prior to group by, just not in the preview for the group by step. 

 

Below is my group by 

any help would be greatly appreciated. 

  • Thanks everyone for you help. I found the solution by reordering my steps and doing the group by earlier in my process rather than as the last step.

9 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Winter_king94 Well, that's sort of the purpose of grouping. If all the unique rows were brought through then it would be the same as not grouping them at all.

  • Thanks, Greg_Deckler ..... I understand that.. Let me try to clarify my problem better with an example..
    I have three distinct email names with 3 distinct ids, and after grouping only one of those emails appears in the preview. The other two emails can't be found. I have tried grouping by the ids, the email names, but am still only ending up with one of the three email names after grouping. 

    • Greg_Deckler's avatar
      Greg_Deckler
      Community Champion

      Winter_king94 I would try loading the query and then make a determination about whether all of the IDs are there or not. I would not trust the Preview pane for that as doing the grouping could switch which of the 1000 rows it grabs from the source system.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Seeing as your data set is so large, you just might not be getting all of the values in the preview, but if you load your data set, they will be there.

     

    --Nate

    • Winter_king94's avatar
      Winter_king94
      Helper I

      Unfortunately, whatever I see in my preview is the only data that loads into desktop. Anything not in the group by preview doesn't flow through. 

      • Anonymous's avatar
        Anonymous
        Not applicable

        I would try grouping on the two columns, and use the "All Rows" aggregation. If that gives you all of your unique values, then use the expand columns aggregations.

         

        --Nate

  • Please share your complete query (the M code from advanced editor).

    A sample of your data will be helpfull.


    Also try to filter on the three emails you were expecting before grouping and see if they appear then. Share what happens?

     

    My wild guess?

     

    Powerquery is free to sort your data anyway it sees fit to process your query the fastest, so your 3 emails may not end up together. You are grouping on 2 columns, so PQ might have decided sort on Email_Sent_Date_CDT first. Could this be the reason you can't find them?
    You can test this by filtering on your 3 email addressses after the group by.

  • Thanks everyone for you help. I found the solution by reordering my steps and doing the group by earlier in my process rather than as the last step.