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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kbachova
Advocate II
Advocate 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
Phil_Seamark
Employee
Employee

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
kbachova
Advocate II
Advocate II

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.

Phil_Seamark
Employee
Employee

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!

v-caliao-msft
Employee
Employee

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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