The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
is there any function which gives us max of values in terms of strings?
not integer 0's and true or false
it should return the column value.
Solved! Go to Solution.
@Anonymous
You can use LASTNONBLANK to return the 'maximum' of a text column.
See this article on SQLBI:
https://www.sqlbi.com/articles/alternative-use-of-firstnonblank-and-lastnonblank/
Hi @Anonymous,
That's right, LASTNONBLANK/FIRSTNONBLANK order text lexicographically.
If you want the text value with greatest length, you can do this or something similar:
Longest Text Value = CALCULATE ( LASTNONBLANK ( MyTable[TextColumn], 0 ), TOPN ( 1, VALUES ( MyTable[TextColumn] ), LEN ( MyTable[TextColumn] ) ) )
If there are ties, they are broken by LASTNONBLANK.
@Anonymous
You can use LASTNONBLANK to return the 'maximum' of a text column.
See this article on SQLBI:
https://www.sqlbi.com/articles/alternative-use-of-firstnonblank-and-lastnonblank/
Hi @OwenAuger,
Actually i found this blog after a little search.
Anyway thank you so much for your reply.
Hi @OwenAuger,
The LastNonBlank and FirstNonBlank fuctions giving me the first and last nonblank strings but i need values with maximum character length in the column.!!
Hi @Anonymous,
That's right, LASTNONBLANK/FIRSTNONBLANK order text lexicographically.
If you want the text value with greatest length, you can do this or something similar:
Longest Text Value = CALCULATE ( LASTNONBLANK ( MyTable[TextColumn], 0 ), TOPN ( 1, VALUES ( MyTable[TextColumn] ), LEN ( MyTable[TextColumn] ) ) )
If there are ties, they are broken by LASTNONBLANK.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
99 | |
94 | |
85 | |
69 | |
65 |
User | Count |
---|---|
244 | |
127 | |
119 | |
81 | |
78 |