Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have table of the following values:
Category1,Category2
A,1
A,2
A,3
A,4
B,1
B,3
B,4
C,2
C,4
I want a measure to return a string summarizing this table as such (order of values not important):
A (1, 2, 3, 4),
B (1, 3),
C (2, 4)
But all I've been able to come up with is
Solved! Go to Solution.
Try like
Measure = var _tab = SUMMARIZE('text' , 'text'[Category1], "_1", CONCATENATEX(DISTINCT('text'[Category2]), 'text'[Category2],",")) return CONCATENATEX( _tab,
[Category1] & " (" & [_1]& ")", ", " & UNICHAR(10))
an alternative solution,
ConcX =
CONCATENATEX(
DISTINCT( 'text'[Category1] ),
'text'[Category1] & ": "
& CALCULATE( CONCATENATEX( DISTINCT( 'text'[Category2] ), 'text'[Category2], ", " ) ),
UNICHAR( 10 )
)
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Try to get more than one row like
Nested List of Values =
var category2list = CONCATENATEX(DISTINCT('Table'[Category2]), 'Table'[Category2], ", ")
return
'Table'[Category1] & " (" & category2list & ")"
or
Nested List of Values =
var category2list = CONCATENATEX('Table', 'Table'[Category2], ", ")
return
'Table'[Category1] & " (" & category2list & ")"
Try like
Measure = var _tab = SUMMARIZE('text' , 'text'[Category1], "_1", CONCATENATEX(DISTINCT('text'[Category2]), 'text'[Category2],",")) return CONCATENATEX( _tab,
[Category1] & " (" & [_1]& ")", ", " & UNICHAR(10))
Thank you! Now to figure out HOW it works.
DAX doesn't accept 'Table'[Category1] in the last line. It's requiring a scalar value.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
8 |