Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin 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.
I really like the fact that you get to choose your own aggregate functions in M
In particular Text.Combine so that I can aggregate by concatenating text. eg databases for Server1, count = 4, names = DB1/DB2/DB3/DB4
I have an example where I have multiple applications associated with a server, some live and some now decommisioned but I want to report:
1) How many applications in total
2) How many still Live
3) What the names of the Live ones are
I can get close with:
#"Grouped Rows" = Table.Group(#"Filtered out xxx", {"ServerName", "DecomStatus", "ServerStatusReason"}, {{"AppCount", each Table.RowCount(_), type number}, {"LiveAppCount", each List.Sum([LiveApp]), type number}, {"ApplicationNames", each Text.Combine([AppName], "/"), type text}}),
LiveAppname is blank if application is not live, but this gives me blanks for the "dead" applications as well and they don't look good in app1/app2///app5
I have tried to limit the span of the last "each" to only include live apps - but I can't fathom the syntax of each with a condition (is it possible). I have tried with/without braces. But fundamentally I don't get the syntax
#"Grouped Rows" = Table.Group(#"xxx", {"ServerName", "DecomStatus", "ServerStatusReason"}, { "ApplicationNames", each ([LiveAppName] <> "") Text.Combine([LiveAppName], "#(cr)#(lf)"), type text})
Solved! Go to Solution.
Hi @mikecrobp
You may try to use List.Select. Show a sample as below:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUSpWitWBsFLArCQgKw3OgjNKlWJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Column1"}, {{"Count", each Text.Combine(List.Select([Column2], each _ <>"") ,"/"), type text}}) in #"Grouped Rows"
Regards,
Cherie
Hi @mikecrobp,
I think the below DAX statement will help you achieve your need
#"Grouped Columns"= Table.Group(#"XXX",{"ServerName","DecmStatus","ServerStatusReason"},{{"ApplicationNames", each Text.Combine([LiveApp],"/")}})
When I tested with some dummy data, this did not show me the blank spaces
Sorry for the delay. In fact my issue is not with using text.Combine as an aggregate function.
it was to use a further qualifier as part of the "each"
I have solved this by creating 2 queries and then joining (merging) them.
Mike
Hi @mikecrobp
You may try to use List.Select. Show a sample as below:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUSpWitWBsFLArCQgKw3OgjNKlWJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Column1"}, {{"Count", each Text.Combine(List.Select([Column2], each _ <>"") ,"/"), type text}}) in #"Grouped Rows"
Regards,
Cherie
Yes. That is what I am looking for. Thank you
Hi @mikecrobp
Here is the reference for you. If it is not your case, please share some simplified data sample.
Regards,
Cherie
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
62 | |
61 | |
55 | |
38 | |
27 |
User | Count |
---|---|
85 | |
60 | |
45 | |
41 | |
39 |