Forum Discussion
Column Filtering containing value
- 5 years ago
Hi Anonymous
Please always show your sample data in text-tabular format in addition to (or instead of) the screen captures. A screen cap doesn't allow people to readily copy the data and run a quick test and thus decreases the likelihood of your question being answered. Just use 'Copy table' in Power BI and paste it here. Or, ideally, share the pbix (beware of confidential data).
Place the following M code in a blank query to see the steps based on a simplified source table:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwUNJRMgRipVgdGNcIlWuMyjWBcY0NLQyNLZC1w0VAJjjl5Cdnp6agShjjkoCbaoTqIiNUFxmhusgIyUWxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [WorkItemId = _t, ChangedDate = _t, TagNames = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"WorkItemId", Int64.Type}, {"ChangedDate", Int64.Type}, {"TagNames", type text}}), #"Filtered Rows" = Table.SelectRows(#"Changed Type", each List.Contains(Table.SelectRows(#"Changed Type", (inner)=> inner[WorkItemId]=[WorkItemId])[TagNames], "Blocked")) in #"Filtered Rows"You can also create a new calculated table in DAX, although I would recommend the PQ route:
NewTable = FILTER( Table1, CALCULATE(COUNT(Table1[TagNames]), Table1[TagNames] = "Blocked", ALLEXCEPT(Table1, Table1[WorkItemId])) > 0 )Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Anonymous , You can create a new column like this and filter blocked
new column =
var _cnt = countx(filter(Table, [workitemid] = earlier([workitemid]) && [Tagnames] ="Blocked"), [workitemid])+0
return
if(_cnt >0 , "Blocked", Blank())