Forum Discussion
Anonymous
3 years agoNot applicable
Omit values based on date within another table
Hi, new to Power Bi but have some SQL experience. Struggling to complete a task and wondered if anyone can help me please? I have Table A which includes a date column (dd/mm/yyyy). It is a standa...
- Anonymous3 years ago
Hi Anonymous ,
I created a sample pbix file(see the attachment), please check if that is what you want.
Method1: Handle it in Power Query Editor:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtE3NtA3MjAyVtJRMjQAEqZKsTrRSqb65jBRC5CMkVJsLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [WeekCommencing = _t, SiteID = _t, StaffNo = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"WeekCommencing", type date}, {"SiteID", Int64.Type}, {"StaffNo", Int64.Type}}), #"FilteredTable" =Table.SelectRows( #"Changed Type" , each not List.Contains(#"Table A"[WeekCommencing], [WeekCommencing])) in #"FilteredTable"Method2: Create a calculated column and filter it out using visual-level filter
Omit = VAR _date = CALCULATE ( MAX ( 'Table A'[WeekCommencing] ), FILTER ( 'Table A', 'Table A'[WeekCommencing] = 'Table B(2)'[WeekCommencing] ) ) RETURN IF ( ISBLANK ( _date ), 1, 0)Best Regards
Anonymous
3 years agoNot applicable
Hi Anonymous ,
I created a sample pbix file(see the attachment), please check if that is what you want.
Method1: Handle it in Power Query Editor:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtE3NtA3MjAyVtJRMjQAEqZKsTrRSqb65jBRC5CMkVJsLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [WeekCommencing = _t, SiteID = _t, StaffNo = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"WeekCommencing", type date}, {"SiteID", Int64.Type}, {"StaffNo", Int64.Type}}),
#"FilteredTable" =Table.SelectRows( #"Changed Type" , each not List.Contains(#"Table A"[WeekCommencing], [WeekCommencing]))
in
#"FilteredTable"
Method2: Create a calculated column and filter it out using visual-level filter
Omit =
VAR _date =
CALCULATE (
MAX ( 'Table A'[WeekCommencing] ),
FILTER ( 'Table A', 'Table A'[WeekCommencing] = 'Table B(2)'[WeekCommencing] )
)
RETURN
IF ( ISBLANK ( _date ), 1, 0)
Best Regards