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.
Hello all!
I'm having issues while creating a new column(or a list), that would allow me to see which person would be unavailable at a specific date. I have a list(table) with person name, start and end date which X person would be on Holiday(for instance). I think that If I could create a column that would give me a row for each day in between those two dates that someone will be unavailable, I would be able to create all kind of reports on top of this information.
What would be the best option in this case and how can I achieve this? I've been trying to use DATESBETWEEN and DATESINPERIOD dax formulas to get this information, but I couldn't make this work.
Thank you!
Solved! Go to Solution.
Hi @Anonymous ,
Based on your description, seems like you want to expand rows based on the two date columns.
You can try this query in power query editor:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUfIsqsxLBNIe+TmZKYmVQJaRgZGhvqG+CYJpoRSrE63kBBTwKs3JTCRGfSwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Alias = _t, Title = _t, Category = _t, EventDate = _t, EndDate = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Alias", type text}, {"Title", type text}, {"Category", type text}, {"EventDate", type date}, {"EndDate", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Date", each {Number.From([EventDate])..Number.From([EndDate])}),
#"Expanded Date" = Table.ExpandListColumn(#"Added Custom", "Date"),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Date",{{"Date", type date}})
in
#"Changed Type1"
Attached a sample file in the below, hopes it could help.
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you all for both of your suggestions! Both will be useful in the future for sure.
Hi @Anonymous ,
Based on your description, seems like you want to expand rows based on the two date columns.
You can try this query in power query editor:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUfIsqsxLBNIe+TmZKYmVQJaRgZGhvqG+CYJpoRSrE63kBBTwKs3JTCRGfSwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Alias = _t, Title = _t, Category = _t, EventDate = _t, EndDate = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Alias", type text}, {"Title", type text}, {"Category", type text}, {"EventDate", type date}, {"EndDate", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Date", each {Number.From([EventDate])..Number.From([EndDate])}),
#"Expanded Date" = Table.ExpandListColumn(#"Added Custom", "Date"),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Date",{{"Date", type date}})
in
#"Changed Type1"
Attached a sample file in the below, hopes it could help.
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
Please check the below picture and the sample pbix file's link down below, whether it is what you are looking for.
All measures are in the sample pbix file.
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
User | Count |
---|---|
117 | |
73 | |
58 | |
49 | |
48 |
User | Count |
---|---|
171 | |
122 | |
60 | |
59 | |
56 |