Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Power Query help
count number of repeating values in "Source-gNB" column and add "Count" column with the count.
S_NodeId | S_Cell | Source-gNB | travelDistance | count |
London | NewYork | MNJ06941A2_231-A_520110 | 3.961 | 2 |
Solved! Go to Solution.
@PSB OK, here's a Power Query solution as well. Add a custom column with this formula:
let
SourceGNB = [#"Source-gNB"],
Count = Table.RowCount(Table.SelectRows(#"Changed Type", each [#"Source-gNB"] = SourceGNB))
in
Count
Here is the full query from Advanced Editor:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("pZAxDoAgDEXvwoyE30KVkVWjFyCE+99CiYkaXCQOHX5++/rblNS6zVaCQySlVbwEDnVbhRhDLJ4sYA+HTZDaQSrrrwhx4xNBhrsRTYovCH4hZFgKSFyoiFroSMCj7xlHM+4w/dnevFCMZT7vzzs=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [S_NodeId = _t, S_Cell = _t, #"Source-gNB" = _t, travelDistance = _t, count = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"S_NodeId", type text}, {"S_Cell", type text}, {"Source-gNB", type text}, {"travelDistance", type number}, {"count", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each let
SourceGNB = [#"Source-gNB"],
Count = Table.RowCount(Table.SelectRows(#"Changed Type", each [#"Source-gNB"] = SourceGNB))
in
Count)
in
#"Added Custom"
@PSB OK, here's a Power Query solution as well. Add a custom column with this formula:
let
SourceGNB = [#"Source-gNB"],
Count = Table.RowCount(Table.SelectRows(#"Changed Type", each [#"Source-gNB"] = SourceGNB))
in
Count
Here is the full query from Advanced Editor:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("pZAxDoAgDEXvwoyE30KVkVWjFyCE+99CiYkaXCQOHX5++/rblNS6zVaCQySlVbwEDnVbhRhDLJ4sYA+HTZDaQSrrrwhx4xNBhrsRTYovCH4hZFgKSFyoiFroSMCj7xlHM+4w/dnevFCMZT7vzzs=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [S_NodeId = _t, S_Cell = _t, #"Source-gNB" = _t, travelDistance = _t, count = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"S_NodeId", type text}, {"S_Cell", type text}, {"Source-gNB", type text}, {"travelDistance", type number}, {"count", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each let
SourceGNB = [#"Source-gNB"],
Count = Table.RowCount(Table.SelectRows(#"Changed Type", each [#"Source-gNB"] = SourceGNB))
in
Count)
in
#"Added Custom"
@PSB Well, of course the DAX for this is trivial but I suppose you want it in Power Query?
Count DAX =
VAR __SNodeId = [S_NodeId]
VAR __SCell = [S_Cell]
VAR __SourcegNB = [Source-gNB]
RETURN
COUNTROWS(FILTER('Table',[S_NodeId] = __SNodeId && [S_Cell] = __SCell && [Source-gNB] = __SourcegNB ))
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.