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
usomaraju
Helper II
Helper II

trying for DAX formula-cant figure it out

Hey Everyone,

 

I'm having an issue getting the right answer from a DAX formula and hoping someone can help me out - been trying for days now

Here is my data

IDDateDays
1632/25/2020 12:353
1632/25/2020 12:473
1632/28/2020 7:373
1642/25/2020 12:340
1642/25/2020 12:470
1653/2/2020 13:145
1653/2/2020 15:435
1663/2/2020 13:166
1663/3/2020 4:096
1733/3/2020 12:350
1743/3/2020 12:3516
1743/3/2020 14:2016
1743/19/2020 19:4216
1743/19/2020 19:4616
1753/3/2020 14:1816
1753/19/2020 19:4416
1753/19/2020 19:5016

 

and the output i need for each id is max date for that id and the no of days

eg: for id 163 the date is 2/28/2020 abd for 164 the date is 2/25/2020 and same for id 165, the output is 3/2/2020.

 

I tried quick meausre based on the max per category and also measure.

nothing worked for me.

 

Any help here would be GREATLY appreciated.

2 REPLIES 2
camargos88
Community Champion
Community Champion

Hi @usomaraju ,

 

Try this measure:

 

Measure = CALCULATE(MAX('Table'[Date]), ALLEXCEPT('Table', 'Table'[ID]))
 
Capture.PNG


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

roopesh_0-1592845129857.png

 

roopesh_1-1592845213685.png

let
    Source = Table.FromRows(table [ID = _t, Date = _t, Days = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Date", type datetime}, {"Days", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"ID"}, {{"MaxDate", each List.Max([Date]), type datetime}, {"Days", each List.Max([Days]), type number}})
in
    #"Grouped Rows"

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.

Top Solution Authors