Forum Discussion
isThisABug
6 years agoFrequent Visitor
Calculated column analysis
Hello everyone, I wante to post this in order to improve my skills and get a better understanding of Power BI. The problem I solved is create a calculated column that concatenates other columns t...
Greg_Deckler
6 years agoCommunity Champion
Well, isThisABug here is a potential improvement. I'm not entirely happy with it because it is still tied to a reasonable maximum approach, you have to code it for the number of items in your sort. But, it is potentially a starting place. PBIX is attached.
Column =
VAR __Table = { [Product 1], [Product 2], [Product 3], [Product 4], [Product 5] }
VAR __word5 = MAXX(__Table,[Value])
VAR __word4 = MAXX(EXCEPT(__Table,{ __word5 }),[Value])
VAR __word3 = MAXX(EXCEPT(__Table,{ __word5, __word4 }),[Value])
VAR __word2 = MAXX(EXCEPT(__Table,{ __word5, __word4, __word3 }),[Value])
VAR __word1 = MINX(__Table,[Value])
RETURN
CONCATENATEX({__word1, __word2, __word3, __word4, __word5 },[Value],",")
I like your implementation of a bubble sort, I'm basically using the same technique.