cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Count if a datetime is distinct

Hello I have a table that looks like this:

expirations.png

 

I'd like to count the expirations that are past due. In the above case for id ending in 774, there would only be 1 expiration despite having multiple certifications expiring on the same day/time. In total for the above table, there would be two expirations not 4. 

 

However, I do not want to look at only distinct date/times because a date and time could apply to multiple ids.

 

What measure could I write to achieve this? Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User VI
Super User VI

Re: Count if a datetime is distinct

You could try a measure expression like this to get your result

 

Expirations =
COUNTROWS (
FILTER (
SUMMARIZE ( Table, Table[id], Table[expiration] ),
Table[expiration] < TODAY ()
)
)

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Please mark my post as a solution! Kudos are also appreciated!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
Highlighted
Super User IX
Super User IX

Re: Count if a datetime is distinct

@gcv1999 , Try a new measure like

countx(summarize(Table, table[id],table[expiration]),[id])



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Super User VI
Super User VI

Re: Count if a datetime is distinct

You could try a measure expression like this to get your result

 

Expirations =
COUNTROWS (
FILTER (
SUMMARIZE ( Table, Table[id], Table[expiration] ),
Table[expiration] < TODAY ()
)
)

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Please mark my post as a solution! Kudos are also appreciated!

Proud to be a Super User!




View solution in original post

Community Support
Community Support

Re: Count if a datetime is distinct

Hi @gcv1999 ,

 

Try this measure.

Measure = 
CALCULATE(
    DISTINCTCOUNT('Sheet1 (2)'[expiration]),
    ALLEXCEPT( 'Sheet1 (2)', 'Sheet1 (2)'[id] )
)

 ccc1.PNG

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
Super User V
Super User V

Re: Count if a datetime is distinct

Hi,

Try this measure

Measure = Calculate(Distinctcount(Data[id]),filter(Data,Data[expiration]<today()))

Hope this helps.


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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors