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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

Top Kudoed Authors