SOLVED

Count of Date in Pivot Table

Copper Contributor

Hi All,

I would like to COUNT the number of days worked within this pivot table, but it is counting every line entry date.

For example this Job number is showing 12 days where it should be showing only 5

Mel_G_01_1-1622505488641.png

Mel_G_01_0-1622505406447.png

 

7 Replies
Hi,

To count the number of UNIQUE days in the range use:
=SUMPRODUCT(1/COUNTIF(enterRangeHere,enterRangeHere))

I'm not sure how to get what you want from a PivotTable.

However, Excel has made several improvements over the past few years so you can do the needful on your own (assuming you have the appropriate version of Excel).

Suppose that

* your data are in a table as Excel understands it (Insert | Table) and

* that the job of interest is in H2. 

Then the 1st formula will give you a list of unique dates for the job and the 2nd formula will give you a count of the unique dates.

=UNIQUE(FILTER(Table1[Date],Table1[Job No]=H2))

 

=COUNTA(UNIQUE(FILTER(Table1[Date],Table1[Job No]=H2)))

 

@Mel_G_01 

Thank you for your suggestions.

I have managed to get the information by including a formula into the data spreadsheet which counted only when the date changed, then refreshed the pivot table so that it showed the actual number of days worked.

best response confirmed by Mel_G_01 (Copper Contributor)
Solution

@Mel_G_01 

Creating PivotTable add data to data model

image.png

and next in Value Field Setting select Distinct Count

image.png

Without data model this option is not available.

@Mel_G_01 

 

Hi Mel, I am struggling with the same issue. Would you mind sharing the formula you used to count the days / day changes.

@Sergei Baklan Thank you!

 

Exactly what i needed and i guess exactly what guys asked for :)

@DenisaKl , you are welcome

1 best response

Accepted Solutions
best response confirmed by Mel_G_01 (Copper Contributor)
Solution

@Mel_G_01 

Creating PivotTable add data to data model

image.png

and next in Value Field Setting select Distinct Count

image.png

Without data model this option is not available.

View solution in original post