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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
FranciscoJVV
Frequent Visitor

Set value to the day after

Hello, I have this little problem that with my knowledge i cant solve (very noob), the thing is i have this table where on some days i got 2 columns with hours, when this is true, the values on the second column should set the day after for example, on 02-02-2020 got 5 hours in total, 3 in the first column and 2 on the second, the 2 hours should set on 02-03-2020, soo, i was trying with some measures, because i need to show the total per day

Captura.JPG

For example on the 13-07-2019 my total hours is 17, on 14-07-2019 is 27 (6+2+6+1+7+2+3) and soo on...

1 ACCEPTED SOLUTION

Hi,

 

Not sure if i understand entirely but if you're asking for a measure that adds the hours from the first column with hours from the previous day in the second column then something like below could possibly work

 

 

 

TotalHours = 
VAR PreviousDayDate = MAX('Table'[Date]) -1
RETURN

SUM('Table'[Hours1]) + 
CALCULATE(
    SUM('Table'[Hours2]), 
    'Table'[Date] = PreviousDayDate
) 

 

 

 

View solution in original post

4 REPLIES 4
vanessafvg
Super User
Super User

@FranciscoJVV  I am little confused about what you asking and also your calculations dont add up.

 

can you explain from a business perspective what is going on here?

 

also can you demonstrate what you want the value to say

for example for the 13/07 your total should be 22?  if not please explain the rule clearly.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




@vanessafvg 

the thing is I work with day and night shifts, and i need to get the total working hours of a person per day, so when in night shifts sometimes they start at 23:00 and end on 02:00, so there is 3 hours, 1 hour and then 2 hours the day after, the problem is i got the day when they start working, so in the image the first column shows the hours made THAT day, and the second column shows the hours made the day AFTER, and i need to show all the hours made for day

Hi,

 

Not sure if i understand entirely but if you're asking for a measure that adds the hours from the first column with hours from the previous day in the second column then something like below could possibly work

 

 

 

TotalHours = 
VAR PreviousDayDate = MAX('Table'[Date]) -1
RETURN

SUM('Table'[Hours1]) + 
CALCULATE(
    SUM('Table'[Hours2]), 
    'Table'[Date] = PreviousDayDate
) 

 

 

 

this works!! thanks, looking to your solution I think i would never get that, thank you

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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