Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Kate_McCulloch
Regular 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. 

 

Kate_McCulloch_0-1754660599014.png

 

 

Thank you 

 

 

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@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]))
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

9 REPLIES 9
Ashish_Mathur
Super User
Super User

Hi,

Here's another way.  Write this measure

Measure = COUNTROWS(Data)
Write this visual calculation
Sum = CALCULATE([Measure],COLLAPSE(ROWS))
Ashish_Mathur_1-1756079445708.png

 

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Kate_McCulloch,

Thanks for reaching out to the Microsoft fabric community forum. It seems you want to calculate for each row (person + contact date), the count of how many contacts that same person had in that same calendar month (and year). As @Cookistador has responded to your query with a measure, kindly go through his response and check if your issue can be resolved.

 

I would also take a moment to thank @Cookistador and @bhanu_gautam, for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.

 

If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

Best Regards,
Hammad.

Anonymous
Not applicable

Hi @Kate_McCulloch,

As we haven’t heard back from you, so just following up to our previous message. I'd like to confirm if you've successfully resolved this issue or if you need further help.

If yes, you are welcome to share your workaround so that other users can benefit as well.  And if you're still looking for guidance, feel free to give us an update, we’re here for you.

 

Best Regards,

Hammad.

Hi Apologies, we had alot of system issues last week, the solution from bhaunu_gautam worked to a point but was having issues with a couple not calculating correctly. I wasn't able to further test anything due to the issues last week

Anonymous
Not applicable

Hi @Kate_McCulloch,

Can you please confirm once you are able to go through the response provided. Also if you need any help, we’re happy to keep working with you on this. 

 

Best Regards,

Hammad.

Anonymous
Not applicable

Hi @Kate_McCulloch,
Hope everything’s going smoothly on your end. As we haven’t heard back from you, so I wanted to check if you were able to go through the response provided.
Still stuck? No worries just drop us a message and we can jump back in on the issue.

 

Best Regards,

Hammad.

Anonymous
Not applicable

Hi @Kate_McCulloch,
We noticed there hasn’t been any recent activity on this thread. If you still need support, just drop a reply here and we’ll pick it up from where we left off.

 

Best Regards,

Hammad.

Cookistador
Super User
Super User

Hi @Kate_McCulloch 

 

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
    )
)
 
Cookistador_0-1754661654603.png

 

(I modified a little bit your sample 🙂 )

bhanu_gautam
Super User
Super User

@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]))
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.