Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello. I have a table, Test, with two columns:
| Locality | Percentage |
| A | 1 |
| B | 2 |
| C | 3 |
| D | 4 |
| E | -1 |
| F | -2 |
I would like to create a measure which lists the positive Localities only in a single string, ordered by Percentage (descending). So in this case it would run "D, C, B and A". I'm using concatenatex and topn to do this.
This is the code I'm using:
It works almost perfectly, but it doesn't give me the answers in order, since TopN doesn't do that. So instead of "D, C, B and A" I get something like "C,B, A and D" - a completely random order. My question is, how can I make sure the Values are concatenated in order? Thanks in advance.
Solved! Go to Solution.
Try using the CONCATENATEX parameters OrderBy_Expression and Order:
Concatenate Measure = CALCULATE (
CONCATENATEX (
TOPN (
COUNTROWS ( DISTINCT ( Test[Locality] ) ) - 1,
test,
Test[Percentage], DESC
),
Test[Locality],
", ",
Test[Percentage],
DESC
) & " and "
& CONCATENATEX ( TOPN ( 1, test, Test[Percentage], ASC ), Test[Locality] ),
Test[Percentage] > 0
)
Proud to be a Super User!
Try using the CONCATENATEX parameters OrderBy_Expression and Order:
Concatenate Measure = CALCULATE (
CONCATENATEX (
TOPN (
COUNTROWS ( DISTINCT ( Test[Locality] ) ) - 1,
test,
Test[Percentage], DESC
),
Test[Locality],
", ",
Test[Percentage],
DESC
) & " and "
& CONCATENATEX ( TOPN ( 1, test, Test[Percentage], ASC ), Test[Locality] ),
Test[Percentage] > 0
)
Proud to be a Super User!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.