Forum Discussion
DAX MAXX function assistance
Playing around with the MAXX function and I want to get the longest song
My table is set up as song title in one column followed by length in the next column,
I want to either find out the longest song just 'time', eg 7.20 or the longeest song title and time, eg Here Comes The Sun, 3.40 etc
I did this as a new column from the table, i'm not sure i'm getting the correct result
Any help greatly appreciated
Hi Jay2077
You can take steps below for reference:
Create the measures:
longesttimesong = MAXX(ALL('Table'),'Table'[Length])longesttimesongtitle = VAR title = CALCULATE ( SELECTEDVALUE ( 'Table'[Song Title] ), FILTER ( ALL ( 'Table' ), 'Table'[Length] = [longesttimesong] ) ) RETURN title & ", " & [longesttimesong]result:
Hope it helps.
Best Regards,
Community Support Team _ Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
7 Replies
- amitchandakSuper User
Jay2077 , this column will give the longest for the related keys. so if they are joined the song id, that will max for song id.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8 - Jay2077Helper III
Like so
longesttimesongtitle =CALCULATE (SELECTEDVALUE ( 'Abbey Road'[Song Title] ),FILTER ( ALL ( 'Abbey Road' ), 'Abbey Road'[Length] = [longesttimesong] ))RETURNtitle & ", " & [longesttimesong]- v-xiaotangCommunity Support
Hi Jay2077
Hope it helps.
Best Regards,
Community Support Team _ Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.