Countifs/Averageifs DAX - Only one Column in Pivot

dcheney01

New Member
Joined
Aug 22, 2018
Messages
1
Hi All,

I'm measuring the amount of visits each employee visits one of our internal buildings. I'm attempting to do a fairly easy distinct count based on 3 criteria (date, building and staff ID). The powerpivot pivot table output shows the persons meta data (manager, org, assigned building) and in the values it show how many times they visited a given building by month(as you can see below). The values (visits) are taking up multiple columns, but I want to show only the average number of hits (average of each month) as 1 column. The average should check to see if the building they visited also matches the building they are assigned. Would also love a rolling 3 or 6 month average also.

I have the following tables in powerpivot

  • Building Visited table (including date, Staff ID, building info) - obviously they can hit a building multiple times in one day...but I only want to count one time.
  • Meta data (Staff ID, Name, manager, org info, assigned building, etc)
  • Cleanup tables (taking building info and cleaning up the nomenclature; cleaning up staff ID)

I've heard some forums mention a calendar table would be helpful, but I don't understand why?

Any help would be great!

Output desired (example only):

IDLast NameFirst NameBuilding (Assigned)Start DateOrganization LeaderOrganizationAverageJanFebMarAprMayJunJulJanFebMarAprMayJunJulJanFebMarAprMayJunJul
2150AdamsBobBuiding11/5/2000Leader ATTBS5.5714295628945431221113
3916DunkerJaneBuiding14/5/2012Leader ABTTBS1.812123
3732WintersAprilBuiding17/12/2015CTWR13.8571414151412141414
9793KimTommyBuiding16/12/2018CTWR1111111111111
6429LowmanSusanBuiding16/13/2018PPWX035111
7963RobinsonFredBuiding16/14/2018PPWX7121411
4323SmithLarsBuiding16/15/2018CTWR11.5617965978
4736RyanSteveBuilding 26/16/2018PPWX5456
1279AustinChrisBuilding 26/17/2018PPWX3.333333442
7884StylesMichelleBuilding 26/18/2018CTWR6.252441512
2936DaveBuilding 26/19/2018PPWX14.83333151515141515
6077JohnBuilding 26/20/2018PPWX2011121202119182021
7949TommyBuilding 36/21/2018TTBS110101214151515141616141311
9191RoyBuilding 36/22/2018TTBS5.522513
9139LeonBuilding 36/23/2018SRS3432
3035JohnBuilding 36/24/2018SRS13.33333141214
8154DavidBuilding 36/25/2018SRS7.7512577
6434GregoryBuilding 36/26/2018SRS11

<colgroup><col><col><col><col span="2"><col><col><col span="23"></colgroup><tbody>
</tbody>


Underlying data:

IDLast NameFirst NameBuilding (Assigned)Building VisitedDate visitedConcatenate (for unique count)
2150AdamsBobBuiding1Building11/5/20182150Building143105
2150AdamsBobBuiding1Building11/5/20182150Building143105
2150AdamsBobBuiding1Building11/6/20182150Building143106
2150AdamsBobBuiding1Building11/7/20182150Building143107
2150AdamsBobBuiding1Building11/8/20182150Building143108
2150AdamsBobBuiding1Building11/8/20182150Building143108
2150AdamsBobBuiding1Building11/9/20182150Building143109
2150AdamsBobBuiding1Building21/5/20182150Building243105
2150AdamsBobBuiding1Building21/10/20182150Building243110
2150AdamsBobBuiding1Building21/15/20182150Building243115
2151AdamsBobBuiding2Building21/20/20182151Building243120
2152AdamsBobBuiding3Building21/30/20182152Building243130
2150AdamsBobBuiding1Building16/5/20182150Building143256
2150AdamsBobBuiding1Building16/6/20182150Building143257
2150AdamsBobBuiding1Building16/7/20182150Building143258
2150AdamsBobBuiding1Building16/8/20182150Building143259
2150AdamsBobBuiding1Building16/8/20182150Building143259
2150AdamsBobBuiding1Building16/9/20182150Building143260
2150AdamsBobBuiding1Building16/10/20182150Building143261
2150AdamsBobBuiding1Building26/11/20182150Building243262
2150AdamsBobBuiding1Building26/12/20182150Building243263
2150AdamsBobBuiding1Building26/12/20182150Building243263
2151AdamsBobBuiding2Building26/9/20182151Building243260
2152AdamsBobBuiding3Building26/10/20182152Building243261
2150AdamsBobBuiding1Building16/11/20182150Building143262
2150AdamsBobBuiding1Building16/12/20182150Building143263
2150AdamsBobBuiding1Building16/13/20182150Building143264
2150AdamsBobBuiding1Building16/14/20182150Building143265

<colgroup><col><col span="2"><col><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,215,659
Messages
6,126,074
Members
449,286
Latest member
Lantern

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