Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
docs
Regular Visitor

Power BI Grouped Rows

I have created a grouped row which shows all notes related to an object id but I only want the last 6 notes created to be shown in this grouped row. Is there any filters I can put in place to do this? 

 

Note: Not all Opportunities will have 6 notes so just need a filter that makes it so the max number of notes that can be pulled through is 6 and they are the last 6 notes entered. Groupedrows.png

1 ACCEPTED SOLUTION
MasonMA
Community Champion
Community Champion

@docs 

 

Hi, ideally you would do this before grouping the rows. but if you wanted to add after your last step, you can also use below logic. It's tested working on my end. 

 

let
    SplitNotes = Table.ExpandListColumn(
        Table.TransformColumns(Grouped Rows, {"Combined Notes", Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.Csv)}),
        "Combined Notes"
    ),

    AddDate = Table.AddColumn(SplitNotes, "NoteDate", each Date.FromText(Text.Start([Combined Notes], 10)), type date),

    Sorted = Table.Sort(AddDate, {{"objectid", Order.Ascending}, {"NoteDate", Order.Descending}}),

    Grouped = Table.Group(Sorted, {"objectid"}, {{"Top6Notes", each Table.FirstN(_, 6), type table [objectid=nullable number, Combined Notes=nullable text, NoteDate=nullable date]}}),

    CombineNotes = Table.TransformColumns(
        Grouped,
        {"Top6Notes", each Text.Combine([Combined Notes], "#(lf)"), type text}
    )
in
    CombineNotes

 

View solution in original post

6 REPLIES 6
V-yubandi-msft
Community Support
Community Support

Hi @docs ,
I wanted to follow up to see if your issue has been resolved. If you still need assistance or have any questions, please let us know.

V-yubandi-msft
Community Support
Community Support

Hi @docs ,

I wanted to follow up to see if your issue has been resolved or if you still need any additional information. If you require further assistance, please let us know.

 

Thank you.

V-yubandi-msft
Community Support
Community Support

Hi @docs ,

Could you let us know if your issue has been resolved or if you are still experiencing difficulties? Your feedback is valuable to the community and can help others facing similar problems.

 

V-yubandi-msft
Community Support
Community Support

Hi @docs ,

Thank you for engaging with the Microsoft Fabric Community.  I tested your request to limit notes per Opportunity to the last 6 entries, and the logic is working as intended.
FYI:

Vyubandimsft_0-1758621250223.png

 

Vyubandimsft_1-1758621275213.png

 

 

Now, each Opportunity displays up to 6 of the most recent notes by CreatedDate. If there are fewer than 6 notes, it will show all available notes. The data is sorted by date (newest first), grouped by Opportunity, and filtered to show the top 6 notes for each.

 

I’ve included the transformation steps I followed for your reference. Please review and let me know if you’d like any changes.

 

regards,
Yugandhar.

MasonMA
Community Champion
Community Champion

@docs 

 

Hi, ideally you would do this before grouping the rows. but if you wanted to add after your last step, you can also use below logic. It's tested working on my end. 

 

let
    SplitNotes = Table.ExpandListColumn(
        Table.TransformColumns(Grouped Rows, {"Combined Notes", Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.Csv)}),
        "Combined Notes"
    ),

    AddDate = Table.AddColumn(SplitNotes, "NoteDate", each Date.FromText(Text.Start([Combined Notes], 10)), type date),

    Sorted = Table.Sort(AddDate, {{"objectid", Order.Ascending}, {"NoteDate", Order.Descending}}),

    Grouped = Table.Group(Sorted, {"objectid"}, {{"Top6Notes", each Table.FirstN(_, 6), type table [objectid=nullable number, Combined Notes=nullable text, NoteDate=nullable date]}}),

    CombineNotes = Table.TransformColumns(
        Grouped,
        {"Top6Notes", each Text.Combine([Combined Notes], "#(lf)"), type text}
    )
in
    CombineNotes

 

ivana_tomekova
Advocate I
Advocate I

Hi... After you sorted your rows and before creating concatenated text, you can add column, which will rank the notes from 1 to n over the objectid... then remove all that are bigger than 6 and then concatenate 😉

How to ingest that nested ranking, you can check here: https://blog.crossjoin.co.uk/2015/05/11/nested-calculations-in-power-query/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.