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

Show latest date of occurence

Hi all,

I am trying to find out a way how to display the latest date of occurence from a specified list.

 

data.png

My parameters from a datasets to make the filter are:

Incident Type.Type: Personal
AND
Incident Type.Subtype: Restricted Work Case OR Lost Time Accident OR Medical Treatment
AND
Incident Report.Incident Party: Company

Which I took care of on a visual level filter ( I am using the Card type visual).
However, when I specify that I want to see the last date (or the first date) it is not displaying the correct date. This is what I got with the last date:

29-Oct-15

And this is with the first date:

15-Oct-15

But the correct date should be:

27-Jul-16

Anyone has any suggestions how to fix it? Or how do I do that? 

Thanks a lot,
Kristina

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: Show latest date of occurence

Is your [DateToLink] column formatted as Text?   If this is the case I recommend you change it to be Date or DateTime type.

 

I suspect it is showing in Alphebetic order rather than Numeric/or Date

 

You can also create measures that look for the first/last date once you have it converted to Date (or DateTime)

 

 

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

3 REPLIES 3
Highlighted
Microsoft
Microsoft

Re: Show latest date of occurence

Hi @kbachova,

 

In your scenario, why the first date is 15-Oct-15? In your sample data, it seems that the first date is 17-Aug-15.  You can create a measue or calculated column to get the first date by using Max function.
https://msdn.microsoft.com/en-us/library/ee634228.aspx

 

If this is not what you want, please elaborate your report structure, so that we can make further analysis.

 

Regards,

Charlie Liao

Highlighted
Microsoft
Microsoft

Re: Show latest date of occurence

Is your [DateToLink] column formatted as Text?   If this is the case I recommend you change it to be Date or DateTime type.

 

I suspect it is showing in Alphebetic order rather than Numeric/or Date

 

You can also create measures that look for the first/last date once you have it converted to Date (or DateTime)

 

 

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

Highlighted
Helper II
Helper II

Re: Show latest date of occurence

Thanks Phil_Seamark,

 

it helped indeed.

 

But then I have another question:

I need to calculate the number of days between the last date of occurence and today. And the TODAY () function does not seem to work the way I was hoping for in this measure:

 

DATEDIFF = DATEDIFF(TODAY(),MAX(HseqAnalysis[Date.Date - as date].[Date]),DAY)

 

As it gives me the difference between today and the end of year instead of number of days for difference between today and the last date of occurence (which if today = 27/02/2017, the difference should be 215 days.)

 

Does anyone know how to solve it, please?

 

Thanks a lot!

 

K.

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Community Summit Australia – Join Online!

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.

Top Solution Authors
Top Kudoed Authors