PivotTable Filter Context in Calculated Column

TCPaul

New Member
Joined
Mar 9, 2016
Messages
1
Hi guys,

I have the following problem; I am trying to create a calculated column that shall later be used as filter in a pivot table which shows if an employee was employed during the selected time filter (e.g. 2016). As a measure this looks works perfectly and looks like:

CurrEmpl:=CALCULATE([Count of Sales Reps],filter(dPeople,MIN(dDates[Date])<=dPeople[End Date]&&max(dDates[Date])>=dPeople[Start Date]))

However, since I can't filter for the result in a pivot table, I have to somehow replicate it as a calculated column, which is not working for me so far; here is my current attempt which is basically the same as the measure:

=calculate(COUNTROWS(dPeople),filter(dPeople,MIN(dDates[Date])<=dPeople[End Date]&&max(dDates[Date])>=dPeople[Start Date]))

This ends up returning 1s all the way, ignoring the date filter that is on the output pivot table.

Any ideas? Thanks ahead!
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
You have to choose between a measure that will react to your slicers and filters on pivots, or a calc column that does not. So if you want a calc column, the only option really is to do the calc at a point in time - eg today. So you could do a calc column in the people table that compares today's date with their start and end dates to see if they are currently employed (yes or no), but then you can't change the period.

If if you put your current measure in values in a pivot, and employee on rows, I assume it will give you a list of current employees for the current date filter context. So what other filtering do you want? Maybe there is another way but it depends what you want to do.
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top