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.
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.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
10 | |
10 | |
9 | |
6 |