Skip to main content

Sorting string data

Natively sorting string data in Power BI will always show either "largest" og "smallest" string. Often this does not make sense. Instead you can use the "updatedate" field to show the most recent string.

NB! Remember to change the name of the DAX measure to match the configured column in the writeback table.


To use the DAX below ensure that the colunm format in the writeback table is datetime.

Using smalldatatime will not suffice as this will always return a blank value if the value is modified more than once within the same minute.


Most recent comment =

VAR commentDate =

CALCULATE(

MAX(your_writeback_table[updatedate_column]),

your_writeback_table[comment_column] <> BLANK()

)

VAR LatestComment =

CALCULATE(

SELECTEDVALUE(your_writeback_table[comment_column]),

your_writeback_table[updatedate_column] = commentDate

)

RETURN

LatestComment