Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
bangerasid
Helper I
Helper I

Power Query - Scenario

bangerasid_0-1652695648831.png

Hi Team,

 

I have above scenario, I am trying to achieve the result in power query but unable to do so.
After doing Table B left join Table A, I am not getting the desired result. 
The join is not taking into consideration the Record ID. Is there any way to achieve the desired result as shown in the snippet?

 

Happy Monday.

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test

CODE FOR TABLE A

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwUNJRMtU31zcyMDJSitVBCBmaIIsZgsWMDKFisQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Record id" = _t, #"week end date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Record id", Int64.Type}, {"week end date", type date}})
in
    #"Changed Type"

CODE FOR TABLE B

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtU31zcyMDJSitUBcQxNkHlGhlBeLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"week end date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"week end date", type date}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Record id", each List.Distinct(#"Table A"[Record id])),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Record id"),
    #"Merged Queries" = Table.NestedJoin(#"Expanded Custom", {"Record id", "week end date"}, #"Table A", {"Record id", "week end date"}, "Table A", JoinKind.LeftOuter),
    #"Expanded Table A" = Table.ExpandTableColumn(#"Merged Queries", "Table A", {"week end date"}, {"week end date.1"}),
    #"Sorted Rows" = Table.Sort(#"Expanded Table A",{{"Record id", Order.Ascending}, {"week end date", Order.Ascending}}),
    #"Added Custom1" = Table.AddColumn(#"Sorted Rows", "check", each if [week end date.1]=null then "absent" else "present")
in
    #"Added Custom1"

View solution in original post

2 REPLIES 2
bangerasid
Helper I
Helper I

That works! I was wondering whether this can be done using dax at the report level (not powerquery)

Vijay_A_Verma
Super User
Super User

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test

CODE FOR TABLE A

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwUNJRMtU31zcyMDJSitVBCBmaIIsZgsWMDKFisQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Record id" = _t, #"week end date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Record id", Int64.Type}, {"week end date", type date}})
in
    #"Changed Type"

CODE FOR TABLE B

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtU31zcyMDJSitUBcQxNkHlGhlBeLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"week end date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"week end date", type date}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Record id", each List.Distinct(#"Table A"[Record id])),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Record id"),
    #"Merged Queries" = Table.NestedJoin(#"Expanded Custom", {"Record id", "week end date"}, #"Table A", {"Record id", "week end date"}, "Table A", JoinKind.LeftOuter),
    #"Expanded Table A" = Table.ExpandTableColumn(#"Merged Queries", "Table A", {"week end date"}, {"week end date.1"}),
    #"Sorted Rows" = Table.Sort(#"Expanded Table A",{{"Record id", Order.Ascending}, {"week end date", Order.Ascending}}),
    #"Added Custom1" = Table.AddColumn(#"Sorted Rows", "check", each if [week end date.1]=null then "absent" else "present")
in
    #"Added Custom1"

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors