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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Creating list of dates per user based on Start/End date

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. 

 

UserPBI_1-1619621344534.png

 

Thank you!

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

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"

date.png

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.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thank you all for both of your suggestions! Both will be useful in the future for sure.

v-yingjl
Community Support
Community Support

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"

date.png

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.

Jihwan_Kim
Super User
Super User

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.

Picture1.png

 

How many people =
CALCULATE (
COUNTROWS ( Data ),
FILTER (
Data,
Data[StartDate] <= MAX ( 'Calendar'[Date] )
&& Data[EndDate] >= MIN ( 'Calendar'[Date] )
)
)
 
 

 

 

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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 Solution Authors
Top Kudoed Authors