cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Helper III

## DISTINCTCOUNT of values YTD

I'm trying to find the number of days an employee has worked. I'm doing this by looking at our appointments and seeing which days an employee has had an appointment. I'm trying to count the number of unique dates up until today.

Does anyone know how to achieve this?

1 ACCEPTED SOLUTION
Super User

Hey @Sohan ,

then you just have to filter the date to be smaller or equal than today:

``````Days Worked until today =
CALCULATE(
COUNTROWS(
VALUES( 'sample'[Date appointment] )
),
'sample'[Date appointment] <= TODAY()
)``````

The results changes accordingly:

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

6 REPLIES 6
Super User

Hey @Sohan ,

you can do a COUNTROWS of VALUES.

If you give some example data, I could give you a solution.

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Helper III

Hi @selimovd, thanks for your reply. Here is some sample data. Let me know if you have questions about it.

Super User

Hey @Sohan ,

the following measure should do it:

``````Days Worked =
CALCULATE(
COUNTROWS(
VALUES( 'sample'[Date appointment] )
)
)``````

The result could then look like that:

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Helper III

Hi @selimovd, thanks for your reply! I was able to achieve this, however I don't want future dates to be counted. I want the dates up until today to be counted.

Super User

Hey @Sohan ,

then you just have to filter the date to be smaller or equal than today:

``````Days Worked until today =
CALCULATE(
COUNTROWS(
VALUES( 'sample'[Date appointment] )
),
'sample'[Date appointment] <= TODAY()
)``````

The results changes accordingly:

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Helper III

Thank you so much!

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors