March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello Experts,
I am trying to extract only the latest date record row from a table with multiple dates per group.
For example: from this table i need only the record row of 1/1/2017 12:00 am of HMY 12.223 and 12.224
So each HMY code can have multiple dates > I need only the latest date record
Thanks for you help!
Solved! Go to Solution.
Hi AMD,
First, create a measure to see the lasted date of each kind HMY code as following formula:
Measure 2 =
CALCULATE ( MAX ( 'Table1'[date] ), ALLEXCEPT ( Table1, Table1[HMY] ) )
Next, create another measure to judge whether the date of every HMY code equals the lasted date of each kind HMY code, this is to say whether the value of ‘date’ column equals ‘Measure 2’ column’s :
Measure 3 = IF ( MAX ( Table1[date] ) = [Measure 2], 1, 0 )
Then, you will see them showing in the Report view:
Finally, on the Visual level filters, select the value of second measure which is equal to 1,and after applying this filter, we will see as follows.
If you have any question, please feel free to ask.
Best regards,
Maggie Li
I have a similar situation but if there is a range date slicer that will control the date range then this solution won`t work because this will give the latest date data based on the raw table but using a date range will not evaluate the next latest date based on range slicer selection.
Hi AMD,
First, create a measure to see the lasted date of each kind HMY code as following formula:
Measure 2 =
CALCULATE ( MAX ( 'Table1'[date] ), ALLEXCEPT ( Table1, Table1[HMY] ) )
Next, create another measure to judge whether the date of every HMY code equals the lasted date of each kind HMY code, this is to say whether the value of ‘date’ column equals ‘Measure 2’ column’s :
Measure 3 = IF ( MAX ( Table1[date] ) = [Measure 2], 1, 0 )
Then, you will see them showing in the Report view:
Finally, on the Visual level filters, select the value of second measure which is equal to 1,and after applying this filter, we will see as follows.
If you have any question, please feel free to ask.
Best regards,
Maggie Li
This was super helpful to me, it let me create a measure for a visual that is effectively equivalent to doing TOP 1 * WITH TIES ORDER BY ROW_NUMBER() OVER (PARTITION BY ID ORDER BY DATE DESC) in sql for my data. Adding in this comment so if anyone is googling how to do TOP 1 WITH TIES in PowerBI, This Is The Way.
@v-juanli-msft is there a way to do this using calculated columns?
I want to pivot the data I have afterwards, so I assume I would need calculated columns instead of measures.
Specifically, I want to do the following:
Manny thanks Maggie for you help 🙂
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
146 | |
97 | |
79 | |
69 |