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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Pbiuserr
Post Prodigy
Post Prodigy

How to calculate Year to date with such database

Hello,

My database structured  like this. I want to calculate YTD value for each month but on distinct values

 

IDDATE_CODSTATUS
ID120220101Active
ID120220201Active
ID120220301Active
ID120220401Terminated
ID220220101Active
ID220220201Terminated

 

20220101 - 2 unique items were active between start of the year till date

20220101 - 2 unique items were active between start of the year till date

20220301 - 2 unique items were active between start of the year till date

because doing it a normal way with datesytd I got 2 for Jan, 3 for Feb, 4 for March. But these are only two items and they were active!

 

 

Thank you in advance for your help

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

use DISTINCTCOUNT() instead of COUNT()

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.