Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I have a Master Table that include list of employees and I want to see who went on an assignment during the Date Period. I want to emphasize that not all employees went on assignment, which mean that not all employees are included in the Assignment Table and I don't want to filter them from the Master Sheet. Below is an example:
Master Table:
Assignment Table:
Master Table after merging should look like this:
Solved! Go to Solution.
Assignment:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyVtJRMtQ31DcyMDICMY1g7FgdoLShIYoYgm2sFBsLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Employee = _t, startDate = _t, endDate = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"startDate", type date}, {"endDate", type date}})
in
#"Changed Type"
Master:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyVtJRMtQ31DcyADJjdRBCRphCxgghIyMjdFUwISRVhoaGKEKxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Employee = _t, #"Date Period" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date Period", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Table.SelectRows(Assignment,(k)=>k[Employee]=[Employee] and k[startDate]<=[Date Period] and k[endDate]>=[Date Period])),
#"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"startDate", "endDate"}, {"startDate", "endDate"})
in
#"Expanded Custom"
Assignment:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyVtJRMtQ31DcyMDICMY1g7FgdoLShIYoYgm2sFBsLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Employee = _t, startDate = _t, endDate = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"startDate", type date}, {"endDate", type date}})
in
#"Changed Type"
Master:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyVtJRMtQ31DcyADJjdRBCRphCxgghIyMjdFUwISRVhoaGKEKxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Employee = _t, #"Date Period" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date Period", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Table.SelectRows(Assignment,(k)=>k[Employee]=[Employee] and k[startDate]<=[Date Period] and k[endDate]>=[Date Period])),
#"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"startDate", "endDate"}, {"startDate", "endDate"})
in
#"Expanded Custom"
@lbendlin Thank you for the solution. However, please recommend another solution for large data? My Master table contain 24 million rows and its been an hour and only 500k is loaded as of now.
Thanks again.
Please provide meaningful amounts of sample data.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
23 | |
20 | |
12 | |
10 | |
10 |