Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello All,
I have the above data set and i want to calculate the average in time and out time of all employee
Solved! Go to Solution.
Please check if the following DAX returns your expected result.
INTIME-avg= CALCULATE ( AVERAGEX (FILTER(Table,Table[IN/OUT]="I"&&Table[time]>=TIME(7,0,0)&&Table[time]<=TIME(11,0,0)),Table[time]), ALLEXCEPT(Table,Table[IN/OUT]))
OUTTIME-avg = CALCULATE ( AVERAGEX (FILTER(Table,Table[IN/OUT]="O"&&Table[time]>=TIME(17,0,0)&&Table[time]<=TIME(20,0,0)),Table[time]), ALLEXCEPT ( Table,Table[IN/OUT]))
Regards,
Lydia
HI @PrachiD
Try this
= CALCULATE ( AVERAGE ( TableName[Time] ), ALLEXCEPT ( TableName, TableName[empl_id], TableName[IN/OUT] ) )
Hello @Zubair_Muhammad ,
I have written the same query but the In Time should be in between 7 Am to 11 Am and the Out Time should be in the range of 5pm to 8 pm . This range I m not able to provide in the same query.
So I just have to write 2 different query with same as u have written but I should be able to provide range as well
for Intime :- 7 Am to 11 Am
for Outtime:-5pm to 8 pm
Average time I should be getting in between this given above range only
Please check if the following DAX returns your expected result.
INTIME-avg= CALCULATE ( AVERAGEX (FILTER(Table,Table[IN/OUT]="I"&&Table[time]>=TIME(7,0,0)&&Table[time]<=TIME(11,0,0)),Table[time]), ALLEXCEPT(Table,Table[IN/OUT]))
OUTTIME-avg = CALCULATE ( AVERAGEX (FILTER(Table,Table[IN/OUT]="O"&&Table[time]>=TIME(17,0,0)&&Table[time]<=TIME(20,0,0)),Table[time]), ALLEXCEPT ( Table,Table[IN/OUT]))
Regards,
Lydia
User | Count |
---|---|
92 | |
85 | |
76 | |
66 | |
62 |
User | Count |
---|---|
110 | |
96 | |
95 | |
64 | |
57 |