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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Eleanor24
Frequent Visitor

Check If ID Is In Another Table On A Daily Basis

I have two tables:

1) Contains a list of only IDs for providers

2) Contains a list of IDs for providers who are available and the date(s) they are available

 

I want to check if the provider has availability on any given day. I'm trying to create a table that shows all of the providers by id (table1), and cross-reference that with the table of IDs that contain providers who are working on any given day. I just want to add a yes/no column to table1 signifying that they are or are not working, then be able to filter that using a slicer for the date.

It should be a very simple fix but I am only finding providers who are working, not both. I think it's because everything I'm doing is dependent on a date that is only found in the table of availability. Any help would be appreciated.

 

Table 1.

ID
1
2
3
4

 

Table 2.

IDOn Schedule Date
24/29/2024
34/29/2024

 

Desired Outcome:

IDWorking Y/N
1N
2Y
3Y
4

N

1 ACCEPTED SOLUTION
adudani
Super User
Super User

hi @Eleanor24 ,

 

copy and paste the below code into the advanced editor of a blank query:

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmDSRCk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}}),
    #"Table 2 lookup" = Table.AddColumn(#"Changed Type", "Table2", each #"Table 2"[ID]),
    #"Working Y/N" = Table.AddColumn(#"Table 2 lookup", "Working Y/N", each if List.ContainsAny([Table2],{[ID]}) = true then "Y" else "N", type text),
    #"Removed Columns" = Table.RemoveColumns(#"Working Y/N",{"Table2"})
in
    #"Removed Columns"

 

 

adudani_0-1714429823464.png

 

 

note:

if the on schedule date has multiple dates, this is not an ideal solution it could be Y/N for schedules on any of the multiple dates.

if this is the case, kindly provide a sample input and expected output for the same.

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a Kudos 🙂
Kind Regards,
Avinash

View solution in original post

1 REPLY 1
adudani
Super User
Super User

hi @Eleanor24 ,

 

copy and paste the below code into the advanced editor of a blank query:

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmDSRCk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}}),
    #"Table 2 lookup" = Table.AddColumn(#"Changed Type", "Table2", each #"Table 2"[ID]),
    #"Working Y/N" = Table.AddColumn(#"Table 2 lookup", "Working Y/N", each if List.ContainsAny([Table2],{[ID]}) = true then "Y" else "N", type text),
    #"Removed Columns" = Table.RemoveColumns(#"Working Y/N",{"Table2"})
in
    #"Removed Columns"

 

 

adudani_0-1714429823464.png

 

 

note:

if the on schedule date has multiple dates, this is not an ideal solution it could be Y/N for schedules on any of the multiple dates.

if this is the case, kindly provide a sample input and expected output for the same.

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a Kudos 🙂
Kind Regards,
Avinash

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors