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.
Hi all,
Pretty new to PowerBi so apologies for the basic question.
I've been using Group By but it's no longer achieving what I need and want to find a better way to group values. I want to group by week ending, item, and then the latest result in each phase. Someone had recommended using aggregation and the max operation on the phases to achieve the last results but as you can see from the example below H3 is 4 and H5 is 1 so it would return a value of 4 when in actuality at weeks ending the last value recorded was 1.
I messed around with it a bit and tried the max value on the date and then the aggregate groupings though it still results in the incorrect result.
Solved! Go to Solution.
Hi @dd_au ,
You're correct, using MAX aggregators in the Group By isn't going to help you here - you need to group to a nested table then select the row of data which has the MAX of [date].
Try this:
1) Group By [week ending] and [item]. For the aggregate column, choose the 'All Rows' operator and call this column 'data'.
2) Now you have your nested table column, add a new custom column like this:
Table.Max([data], "date")
You will now have a nested Record column that contains the full row of data for the max [date] value.
3) Expand the nested Record column, choosing whichever columns you want to reinstate back to the table.
Pete
Proud to be a Datanaut!
Hi @dd_au ,
You're correct, using MAX aggregators in the Group By isn't going to help you here - you need to group to a nested table then select the row of data which has the MAX of [date].
Try this:
1) Group By [week ending] and [item]. For the aggregate column, choose the 'All Rows' operator and call this column 'data'.
2) Now you have your nested table column, add a new custom column like this:
Table.Max([data], "date")
You will now have a nested Record column that contains the full row of data for the max [date] value.
3) Expand the nested Record column, choosing whichever columns you want to reinstate back to the table.
Pete
Proud to be a Datanaut!
Thanks Pete! This worked a treat. This will be pretty handy in the future.
Cheers,
DD
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.