Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have a transaction table of procedure audits. The same procedure may have been audited multiple times, and I want to find the latest date a particular procedure was audited and who conducted the audit. How do I do this?
The fields are all in the same table: Audit end Date, Procedure ID and Audited By ID.
Procedure ID Audit End Date Audited By ID
abc 8/11/17 1:00 pm Sam
abc 9/17/17 7:00am Fred
abc 9/17/17 10:00 am Sally
def 7/1/17 9:30 am Sally
def 8/15/17 11:00 am Greg
So, I want results to show:
abc, 9/17/17 by Sally
def, 8/15/17 by Greg
and so on.
Help is greatly appreciated. Thanks!
Solved! Go to Solution.
Hey,
I would create a new calculated column in your table that flags the latest date. This new column then can be used as filter or even used on a slicer, this DAX statement for the new calculated column would look like this:
Is latest audit = IF('yourtablename'[Audit End Date] = CALCULATE( MAX('yourtablename'[Audit End Date]) ,ALLEXCEPT('yourtablename', 'yourtablename'[Procedure ID]) ) ,"True" ,"False" )
Hope this is what you are looking for
Regards
Tom
Hey,
I would create a new calculated column in your table that flags the latest date. This new column then can be used as filter or even used on a slicer, this DAX statement for the new calculated column would look like this:
Is latest audit = IF('yourtablename'[Audit End Date] = CALCULATE( MAX('yourtablename'[Audit End Date]) ,ALLEXCEPT('yourtablename', 'yourtablename'[Procedure ID]) ) ,"True" ,"False" )
Hope this is what you are looking for
Regards
Tom
Thanks, Tom!
If the aggregation is part of your data shaping process (i.e. if you only need the latest audits in your data model), then Power Query would be an appropriate way to go:
let
Source = Audits,
#"Grouped Rows" = Table.Group(Source, {"Procedure ID"}, {{"Last Audit", each Table.Max(_,each [Audit End Date]), type record}}),
#"Expanded Last Audit" = Table.ExpandRecordColumn(#"Grouped Rows", "Last Audit", {"Audit End Date", "Audited By ID"}, {"Audit End Date", "Audited By ID"}),
#"Restored Column Types" = Value.ReplaceType(#"Expanded Last Audit",Value.Type(Source))
in
#"Restored Column Types"
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
74 | |
73 | |
56 | |
38 | |
31 |
User | Count |
---|---|
83 | |
64 | |
63 | |
49 | |
45 |