Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello, thank you all for taking the time to reply to my post. I am looking for help in writing a DAX code which iterates through a matrix row and selects the top three minimum values, then returns a concatenation of the three minimum values in text for. For example, the table below returns the three minimum values for each row of the matrix:
I've tried setting up a DAX code using a combination of variables, temp tables, MINX, and concatentation, but the concatentation will only pick up the first piece of text and will leave out the remaining piece of text. Any help would be greatly appreciated!!
Solved! Go to Solution.
Create a new measure as
Minimum Three =
var tmpTable = { ( "Cost of living", SELECTEDVALUE('Table'[Cost of living])),
( "Housing", SELECTEDVALUE('Table'[Housing]))
... etc
}
return CONCATENATEX( TOPN( 3, tmpTable, [Value2], ASC), [Value1], ", ")
I think it should work if you wrap each column reference inside SELECTEDVALUE
How would I set that up?
Create a new measure as
Minimum Three =
var tmpTable = { ( "Cost of living", SELECTEDVALUE('Table'[Cost of living])),
( "Housing", SELECTEDVALUE('Table'[Housing]))
... etc
}
return CONCATENATEX( TOPN( 3, tmpTable, [Value2], ASC), [Value1], ", ")
Thanks, but that didn't work b/c the columns in the matrix are measure and not actual columns in the data model. Is there another function I can use instead of selectedvalues?
Just use [Cost of living] instead of the column reference. The measures should each be calculated in the correct context from the matrix visual, so it should work
Thank you so much!!! That worked!!
You could try adding a calculated column as
Minimum Three =
var tmpTable = { ( "Cost of living", 'Table'[Cost of living]),
( "Housing", 'Table'[Housing])
... etc
}
return CONCATENATEX( TOPN( 3, tmpTable, [Value2], ASC), [Value1], ", ")
Hi, thank you for your reply. Is there a way to set this up w/o using calculated columns and using a measure only? I have a live connection to the datasource so unfortunately I can't created calculated columns...
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
11 | |
9 | |
6 |