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.
Hello All,
I have got a table which has Employee Name, Date and Hours Worked. See data below -
Date | Employee Name | Week Number | Hours Worked | Expected Result |
02/11/2020 | ABC | 7 | 2 | 34 |
02/12/2020 | ABC | 7 | 2 | 34 |
02/11/2020 | ABC | 7 | 3 | 34 |
02/12/2020 | ABC | 7 | 3 | 34 |
02/13/2020 | ABC | 7 | 8 | 34 |
02/14/2020 | ABC | 7 | 8 | 34 |
02/15/2020 | ABC | 7 | 8 | 34 |
02/11/2020 | XYZ | 7 | 8 | 42 |
02/12/2020 | XYZ | 7 | 8 | 42 |
02/13/2020 | XYZ | 7 | 8 | 42 |
02/14/2020 | XYZ | 7 | 8 | 42 |
02/15/2020 | XYZ | 7 | 10 | 42 |
So what I would like to do is calculate the hours by ABC in week 7. The week starts on Thursday. So on and so forth.
Thanks in Advance.
Solved! Go to Solution.
Hi @Anonymous ,
Try this formula please.
Column = CALCULATE(SUM('Table'[Hours Worked]),FILTER('Table','Table'[Employee Name]=EARLIER('Table'[Employee Name])&&'Table'[Week Number]=EARLIER('Table'[Week Number])))
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Try this formula please.
Column = CALCULATE(SUM('Table'[Hours Worked]),FILTER('Table','Table'[Employee Name]=EARLIER('Table'[Employee Name])&&'Table'[Week Number]=EARLIER('Table'[Week Number])))
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
if I understand you correct you need a measure like
CALCULATE(SUM(Table[Hours Worked]), ALLEXCEPT(Table, Table[Employee Name], Table[Week Number]) )
@Anonymous
it will have completely the same formula
@az38 I had already tried this solution. It gives incorrect solution.
For example, for employee ABC the total hours come out as 40. The answer is same for Column and measure.
Hi @Anonymous,
the measure or formula for the calculated column of @az38 with your sample data is correct:
Regards FrankAT
@Anonymous
it shouldn't be as ALLEXCEPT() remove all filters except Employee Name and Week Number
Check your data first.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
82 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |