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.
Hi all,
I would like to be able to calculate the average values for a specific employee, but I need the values to be restricted to a certain date range that starts after "Phase 2". See example data below.
For example, I would like to be able to calculate the average "Value" for Employee "01" for the first 30 days of "Phase 2". In this example, only the first 4 values for Employee 01 Phase 2 would be included, since those are included in the 30 days following the first occurrence of Phase 2.
Let me know if more clarification would be helpful, many thanks in advance!
Solved! Go to Solution.
Hi @Anonymous
Create measures
start date = CALCULATE(MIN(Sheet6[date]),FILTER(ALLEXCEPT(Sheet6,Sheet6[Employee id]),Sheet6[phase]="phase2")) first 30 days = [start date]+30 flag = IF(MAX(Sheet6[date])<=[first 30 days]&&MAX(Sheet6[date])>=[start date],1,0) average = CALCULATE(AVERAGE(Sheet6[value]),FILTER(ALLEXCEPT(Sheet6,Sheet6[Employee id]),[flag]=1))
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
Create measures
start date = CALCULATE(MIN(Sheet6[date]),FILTER(ALLEXCEPT(Sheet6,Sheet6[Employee id]),Sheet6[phase]="phase2")) first 30 days = [start date]+30 flag = IF(MAX(Sheet6[date])<=[first 30 days]&&MAX(Sheet6[date])>=[start date],1,0) average = CALCULATE(AVERAGE(Sheet6[value]),FILTER(ALLEXCEPT(Sheet6,Sheet6[Employee id]),[flag]=1))
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
101 | |
86 | |
64 |