Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello guys.
I have wrote functions to assign sequential numbers for each group that everyone wanted but hadn't yet invented.
https://github.com/takeyamajp/PowerQuery-IndexRowsForEachGroup
In this library, it is possible to assign sequential numbers in the exact and intended order.
Also, This library fully preserves column type information.
let
Source = #table(type table[Region = text, Country = text], {
{"Asia", "Australia"},
{"Asia", "China"},
{"Asia", "India"},
{"Asia", "Japan"},
{"Europe", "France"},
{"Europe", "Germany"},
{"Europe", "United Kingdom"},
{"North America", "Canada"},
{"North America", "United States"}
}),
Custom1 = IndexRowsForEachGroup(Source, "Region", {"Region", "Country"}, "INDEX1"),
Custom2 = CountRowsForEachGroup(Custom1, "Region", "COUNT1"),
Custom3 = IndexGroups(Custom2, "Region", {"Region", "Country"}, "INDEX2"),
Custom4 = CountGroups(Custom3, "Region", "COUNT2"),
Custom5 = IndexRows(Custom4, {"Region", "Country"}, "INDEX3"),
Custom6 = CountRows(Custom5, "COUNT3")
in
Custom6
Thanks for these, I think they will be useful.
Cheers,
Peter
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
9 | |
7 | |
6 | |
6 |