Forum Discussion
Merge Date/Time tables with ranges
- Anonymous3 years ago
Hi modxplus ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create two calculated columns .
Absence hours = var a= LOOKUPVALUE('Absence Table'[End],'Absence Table'[Name],[Name]) var b=LOOKUPVALUE('Absence Table'[Start],'Absence Table'[Name],[Name]) return SWITCH(TRUE(),[Date]=DATEVALUE(b)&&[Date]<DATEVALUE(a),HOUR([End Date/Time]-b),[Date]>DATEVALUE(b)&&[Date]<DATEVALUE(a),[Total Hours Worked],[Date]=DATEVALUE(a)&&[Date]=DATEVALUE(b),HOUR(a-b),[Date]=DATEVALUE(a)&&[Date]>DATEVALUE(b),HOUR(a-[Start Date/Time]),0)Absence Type = var a=LOOKUPVALUE('Absence Table'[Type],[Name],[Name]) return IF([Absence hours]<>0,a)(3) We can create a table.
Table = SUMMARIZE('Hours Worked Table',[Name],[Date],[Total Hours Worked],'Hours Worked Table'[Absence hours],[Absence Type])(4)Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I have two set of tables (Hour Start) (Hour End) that has data collected in every 30 minutes duration. Using Power Query How do I merge them to Hourly data.I have zero knowledge on DAX but exploring other transformation tools. Your help is highly appreciated. Thanks