HOW TO CALCULATE NO OF HOURS PRESENT IN A MONTH FOR EACH STAFF

I have column Value No Of hours present in a day..

I Need No Of hours present in last month value for each staff

please any one clarify my doubt

 

 

Solved Solved
0 1 52
1 ACCEPTED SOLUTION

Depending on where you want your results, a required expression may vary.

If you want to show the result in the rows of the table you have [No Of hours] , then something like below will give you the result.

 

SUM(
 SELECT(table[No Of hours],
  AND(MONTH([date]) = (MONTH(TODAY()) - 1),
   [employee] = [_THISROW].[employee]
  )
 )
)

 

Or rather if you have a separate table to store results with fields..

[id], [employee], [month], [No of hours], [result] (Edited: You only need [No of Hours])

Then the result col can be obtained by 

 

SUM(
 SELECT(data_table[No Of hours],
  AND(MONTH([date]) = [_THISROW].[month],
   [employee] = [_THISROW].[employee]
  )
 )
)

 

 

View solution in original post

1 REPLY 1

Depending on where you want your results, a required expression may vary.

If you want to show the result in the rows of the table you have [No Of hours] , then something like below will give you the result.

 

SUM(
 SELECT(table[No Of hours],
  AND(MONTH([date]) = (MONTH(TODAY()) - 1),
   [employee] = [_THISROW].[employee]
  )
 )
)

 

Or rather if you have a separate table to store results with fields..

[id], [employee], [month], [No of hours], [result] (Edited: You only need [No of Hours])

Then the result col can be obtained by 

 

SUM(
 SELECT(data_table[No Of hours],
  AND(MONTH([date]) = [_THISROW].[month],
   [employee] = [_THISROW].[employee]
  )
 )
)

 

 

Top Labels in this Space