# Context Tags
**Software** : [[02 - Tags/Software/Power Query]]
**Functions** used **:** [[Table.Group]] [[Text.Combine]] [[List.Sum]] [[Number.From]] [[Excel.CurrentWorkbook]]
**Date** : 15 March 2025
# Description
- The Group Function in M-Query is super powerful and it has 5 Arguments
- Most people only use the first 3 Arguments
- In this video I show you how to use the 4th and 5th Arguments
![[Pasted image 20250315143021.png]]
- The Custom Comparer enabling you to create dynamic Groups
# Video Link
<iframe width="560" height="315" src="https://www.youtube.com/embed/wMWrFJdqssw?si=HHV9faNTXiDY8MlE" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
File Link : [Follow Along File Link](https://github.com/jbotes/powerbiTutorials/blob/main/PQ_Portfolio_Comparer_Video.xlsx)
```mquery
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type date}, {"Portfolio", type text}, {"Amount", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type",
{"date"},
{
{"Portfolios", each Text.Combine([Portfolio],", ") },
{"TotalAmount", each List.Sum([Amount]), type nullable number}
},
GroupKind.Local,
(x,y)=> Number.From(y[date] is date)
)
in
#"Grouped Rows"
```
#### Optional Tags
**Tags** :
**Technique** : [[Dynamic Grouping]]