Forum Discussion
Kate_McCulloch
1 year agoRegular Visitor
Count unique Values in a month
I'm trying to count how many contacts a person has had in a month, the end column is what I would like it to calculate but struggling to find a measure to do this, can anyone help. T...
- 1 year ago
Kate_McCulloch , Try using
Contacts in Month =
CALCULATE(
COUNT('Table'[Contact Date]),
FILTER(
'Table',
'Table'[UNIQUE ID] = EARLIER('Table'[UNIQUE ID]) &&
MONTH('Table'[Contact Date]) = MONTH(EARLIER('Table'[Contact Date])) &&
YEAR('Table'[Contact Date]) = YEAR(EARLIER('Table'[Contact Date]))
)
)
Cookistador
Super User
1 year ago
The following dax measure should work
Contacts in Month =
VAR CurrentPerson = SELECTEDVALUE('Table'[UNIQUE ID])
VAR CurrentMonth = MONTH(SELECTEDVALUE('Table'[Contact Date]))
VAR CurrentYear = YEAR(SELECTEDVALUE('Table'[Contact Date]))
RETURN
CALCULATE(
COUNTROWS('Table'),
FILTER(
ALL('Table'),
'Table'[UNIQUE ID] = CurrentPerson &&
MONTH('Table'[Contact Date]) = CurrentMonth &&
YEAR('Table'[Contact Date]) = CurrentYear
)
)
(I modified a little bit your sample 🙂 )