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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
paulfink
Post Patron
Post Patron

Add dates based on my start and end dates & Split figures in a column into multiple rows

hi guys,

 

i need some quick help with the above 2 problems.

 

Problem 1: I need to split my lines by days but i only have Start and End Dates (2 Seperate columns)

 

Is pretty straightforward. See desired output at bottom of post.

 

Problem 2: I need to split duration into multiple rows

 

This needs to be done in order of Problem 1 and Problem 2.

 

i have a column that tracks time but it is the total time and not per day which i need for a visual that has is an indepth look into particular projects.

 

If the figure is 3 then itll split into 3 different rows as 1

If the figure is 4.5 then itll split into 5 rows - 4 of them being 1 and the 5th being 0.5

 

This needs to be done in order of Problem 1 and Problem 2.

 

Current Data - 

Start DateEnd DateDuration
22/03/202126/03/20214.5

 

Desired output - 

Start DateEnd DateDurationDayDuration
22/03/202126/03/20214.522/03/20211
22/03/202126/03/20214.523/03/20211
22/03/202126/03/20214.524/03/20211
22/03/202126/03/20214.525/03/20211
22/03/202126/03/20214.526/03/20210.5

 

Does this make sense?

 

I can clarify if needed.

 

Replies will be very quick.

1 ACCEPTED SOLUTION

Hi, @paulfink 

Thank you for your feedback.

please try the below. I took out DayMeasure.

 

Duration =
VAR betweendays =
DATEDIFF (
SELECTEDVALUE ( Data[Start Date] ),
SELECTEDVALUE ( Data[End Date] ),
DAY
)
VAR actualduration =
SUM ( Data[Duration] )
VAR lastdayvalue = actualduration - betweendays
VAR lastday =
SELECTEDVALUE ( Data[End Date] )
VAR startday = SELECTEDVALUE( Data[Start Date])
RETURN
IF (
MAX(dates[Date]) >= startday && MAX(dates[Date]) < lastday, COUNTROWS ( dates ),
 
IF ( MAX ( dates[Date] ) = lastday, lastdayvalue, BLANK() )
)
 
Did I answer your question? Mark my post as a solution!
Appreciate your Kudos!!

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.

View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Sorry, I have changed my pbix file a little to look the same as your desired output.

 

https://www.dropbox.com/s/yxf1q0mx8l7y6ab/paulfink%202021%200325.pbix?dl=0 

 

Picture1.png


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.
Jihwan_Kim
Super User
Super User

Hi, @paulfink 

Please correct me if I wrongly understand your question.

 

I created a custom-date-table, but not connected to the main fact table, to create a table visual for your question.

 

If there are more tables, more rows, and more columns are involved, please share the sample data file.

Then I can look into it more accurately.

 

My pbix sample file's link is down below.

Picture1.png

Day Measure =
IF (
AND (
MAX ( dates[Date] ) >= SELECTEDVALUE ( Data[Start Date] ),
MAX ( dates[Date] ) <= SELECTEDVALUE ( Data[End Date] )
),
MAX ( dates[Date] ),
BLANK ()
)
 
Duration =
VAR betweendays =
DATEDIFF (
SELECTEDVALUE ( Data[Start Date] ),
SELECTEDVALUE ( Data[End Date] ),
DAY
)
VAR actualduration =
SUM ( Data[Duration] )
VAR lastdayvalue = actualduration - betweendays
VAR lastday =
SELECTEDVALUE ( Data[End Date] )
RETURN
IF (
ISBLANK ( [Day Measure] ),
BLANK (),
IF ( MAX ( dates[Date] ) = lastday, lastdayvalue, COUNTROWS ( dates ) )
)
 
 
Did I answer your question? Mark my post as a solution!
Appreciate your Kudos!!

 


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.

hi @Jihwan_Kim you did some good stuff thank you.

 

However, the Duration measure isnt giving me the 0.5

 

since i posted i was tested some things and realised i just jump put in my Calendar [Dates] into the table and it splits. I tried altering the Duration measure so it doesnt include the Day Measure, could you help me find a way to use my calendar dates instead of the day measure?

Hi, @paulfink 

Thank you for your feedback.

please try the below. I took out DayMeasure.

 

Duration =
VAR betweendays =
DATEDIFF (
SELECTEDVALUE ( Data[Start Date] ),
SELECTEDVALUE ( Data[End Date] ),
DAY
)
VAR actualduration =
SUM ( Data[Duration] )
VAR lastdayvalue = actualduration - betweendays
VAR lastday =
SELECTEDVALUE ( Data[End Date] )
VAR startday = SELECTEDVALUE( Data[Start Date])
RETURN
IF (
MAX(dates[Date]) >= startday && MAX(dates[Date]) < lastday, COUNTROWS ( dates ),
 
IF ( MAX ( dates[Date] ) = lastday, lastdayvalue, BLANK() )
)
 
Did I answer your question? Mark my post as a solution!
Appreciate your Kudos!!

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors