Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I currently have a set of data in excel which gives me the start date and end date (in the future) for working hours of an employee.
What I need to show is a complete breakdown of this on a calendar via a daily version so it should read something like the below view:
Are you able to advise what formula I should use. I have the working hours table (Image 1) and then I have a calendar built into BI from 2023 onwards
Solved! Go to Solution.
Hello @JPSingh ,
You can make use of "Generate" to create such table. Here is the DAX for the same
I hope this will solve your issue. Please mark this as a solution if this solves your problem. You can say special thank you by giving Kudos :).
Hello @JPSingh ,
You can make use of "Generate" to create such table. Here is the DAX for the same
I hope this will solve your issue. Please mark this as a solution if this solves your problem. You can say special thank you by giving Kudos :).
You can also do this in SQL if your data is in database.
WITH CTE AS (
-- Recursive CTE to generate the dates
SELECT FName, StartDate AS DateValue, EndDate
FROM Test_Table
UNION ALL
SELECT FName, DATEADD(DAY, 1, DateValue), EndDate
FROM CTE
WHERE DateValue < EndDate
)
SELECT FName, DateValue AS [Date]
This is maybe not the most performant option, but should be enough for this:
Show if active =
VAR __Start = MAX('Table'[Start])
VAR __End = MAX('Table'[End])
RETURN
IF(
SELECTEDVALUE(Dates[Date]) >= __Start &&
SELECTEDVALUE(Dates[Date]) <= __End,
SELECTEDVALUE('Table'[Full Name])
)
Good luck!
you can try this in PQ
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCspPysxT8MjPT1HSUXL1dXUEUm4hrkDSXM8USBoZGJnom+obmUPYZvqGRvrGhkqxOtFKbjmJxRkK7vlFKYl56JotwMoNDPQN9Q3RdMYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Full Name" = _t, Region = _t, FTE = _t, #"Daily Hour" = _t, Start = _t, End = _t]),
#"Added Custom" = Table.AddColumn(Source, "Custom", each {Number.From(Date.From([Start]))..Number.From(Date.From([End]))}),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Custom",{{"Custom", type date}})
in
#"Changed Type"
pls see the attachment below
Proud to be a Super User!
@ryan_mayu - Thank you for this. I think this is the solution I am looking for however, this doesn't seem to work. The data transforms the start and end to a date. When I change to text values to try and replicate what you have this doesn't work either. Do this need to be linked back to a Calendar?
if the column is already date type , you can try this
= Table.AddColumn(Source, "Custom", each {Number.From([Start])..Number.From([End])})
Change the Source to your last step name
Proud to be a Super User!
@ryan_mayu Apologise as am unsure what you meant by change the source name to your last step: I made the changes which are
The issue is when I apply the formla and go to expand the table your data is showing values however, my data when I get to the expand option shows me the below:
Your last step is changed type not Source, then change Source to #Changed Type in the coding.
Proud to be a Super User!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
84 | |
72 | |
68 | |
41 | |
35 |
User | Count |
---|---|
109 | |
56 | |
52 | |
48 | |
42 |