Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
I am having some troubles accomplishing following. If i have same id but the countries are different I want to keep country that is not Canada.
I have table
code | country |
11111 | Canada |
11111 | Albania |
22222 | Canada |
33333 | Canada |
33333 | Belgium |
33333 | Canada |
33333 | Belgium |
44444 | Canada |
44444 | Canada |
44444 | Canada |
And I need to get here. How would I do this?
code | country |
11111 | Albania |
22222 | Canada |
33333 | Belgium |
44444 | Canada |
Solved! Go to Solution.
Se this solution
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMgQBJR0l58S8xJREpVgdhJBjTlJiXiZEzAgEUJUZgwB2IafUnPTM0lxSlJmAAKoyIoRiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [code = _t, country = _t]),
#"Filtered Rows" = Table.SelectRows(Source, each ([country] <> "Canada"))&Source,
#"Removed Duplicates" = Table.Distinct(#"Filtered Rows", {"code"})
in
#"Removed Duplicates"
Hi @stribor45 ,
The answer provided by @Omid_Motamedise @AlienSx has resolved your issue? If so, kindly mark the helpful reply as the accepted solution. This will help other community members with similar concerns find solutions more efficiently.
Thank you for your cooperation!"
Se this solution
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMgQBJR0l58S8xJREpVgdhJBjTlJiXiZEzAgEUJUZgwB2IafUnPTM0lxSlJmAAKoyIoRiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [code = _t, country = _t]),
#"Filtered Rows" = Table.SelectRows(Source, each ([country] <> "Canada"))&Source,
#"Removed Duplicates" = Table.Distinct(#"Filtered Rows", {"code"})
in
#"Removed Duplicates"
Hi @stribor45 ,
The answer provided by @Omid_Motamedise @AlienSx has resolved your issue? If so, kindly mark the helpful reply as the accepted solution. This will help other community members with similar concerns find solutions more efficiently.
Thank you for your cooperation!"
can this be adjusted so instead of removing the records just say no if its to be removed and yes if it is to be kept
Table.Group(Source, "code", {"country", (x) => List.Skip(x[country], (c) => c = "Canada"){0}? ?? "Canada"})
Works great. what does this code do
{0}? ?? "Canada"
?: The item-access-expression also supports the form x{y}?
, which returns null
when position (or match) y
does not exist in list or table x
. If there are multiple matches for y
, an error is still raised.
?? : Coalesce operator
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
29 | |
26 | |
16 | |
12 | |
10 |
User | Count |
---|---|
28 | |
24 | |
22 | |
16 | |
12 |