When you create the pivot table, tick the check box 'Add this data to the Data Model'.
After adding a field to the Values area, right-click it and select Value Field Settings... from the context menu.
Distinct Count is now an entry in the list of ways to summarize the data.