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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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