Forum Discussion
Adding column that summarizes values in matrix
Hi All,
First post here, tried Googling for a solution but no luck.
I have a matrix visual that display Employee (row) and the number of hours worked per month (column), for 12 months, like below:
Emp# Jan'17 Feb'17 Mar'17 Apr'17 ...... Dec '17
0001 30 40 40 20 90
0002 80 80 70 50 45
0003 35 67 22 45 36
0004 90 85 10 36 102
I would like to add a column that count the number of months an employee worked over 40 hours.
Thank you,
H.
I assume your data is in tabular (not pivot) format. if not, you need to unpivot it, so it looks like this:
then you can play with the data
1. build matrix with Hours
2. add a measure counting months when an employee worked over 40 hours:
More than 40 hours =
CALCULATE ( COUNT ( Hours[Hours]), Hours[Hours] > 40)hope it helps
4 Replies
- pawel1Kudo Kingpin
I assume your data is in tabular (not pivot) format. if not, you need to unpivot it, so it looks like this:
then you can play with the data
1. build matrix with Hours
2. add a measure counting months when an employee worked over 40 hours:
More than 40 hours =
CALCULATE ( COUNT ( Hours[Hours]), Hours[Hours] > 40)hope it helps
- AnonymousNot applicable
Thank you pawel1, I followed your tip but for some reason the measure doesn't return anything and it just display blank.
Check:
1) HoursCount = CALCULATE(count(v_TimeKeeping[Hours]),v_TimeKeeping[Hours]>40)
2) The data is not in pivot format
- AnonymousNot applicable
sorry nevermind I just had a problem with the filter.
- AnonymousNot applicable
Is there any way to do this count for pivoted data?
my data table has the hours per employee per day so I was using the "bin" function to group the dates.