Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
chock974
Frequent Visitor

topn and concatenatex

I have table with item1, acts and coefficients.
I want to concatenate the acts and coeff by item1 and bring out the top 5 of the most used (acts+coeff).
example :
table.PNG
expected result : resultat.PNG
 
Thx
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @chock974 ,

I create a table as you mentioned.

vyilongmsft_0-1727060750398.png

Next I create a calculated column and a measure.

Concatenated = 'Table'[ACTE] & " " & 'Table'[COEFF]

vyilongmsft_1-1727060789250.png

Measure = 
CALCULATE (
    COUNTROWS ( 'Table' ),
    ALLEXCEPT ( 'Table', 'Table'[Concatenated] )
)

Then I create two new tables and it will give you what you want.

GroupedTable =
SUMMARIZE (
    'Table',
    'Table'[ITEM1],
    "ConcatenatedActs", CONCATENATEX ( 'Table', 'Table'[Concatenated], ", " )
)

vyilongmsft_2-1727060911261.png

Top5Concatenations =
TOPN (
    5,
    SUMMARIZE ( 'Table', 'Table'[Concatenated], "Count", 'Table'[Measure] ),
    [Count], DESC
)

vyilongmsft_3-1727060956160.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @chock974 ,

I create a table as you mentioned.

vyilongmsft_0-1727060750398.png

Next I create a calculated column and a measure.

Concatenated = 'Table'[ACTE] & " " & 'Table'[COEFF]

vyilongmsft_1-1727060789250.png

Measure = 
CALCULATE (
    COUNTROWS ( 'Table' ),
    ALLEXCEPT ( 'Table', 'Table'[Concatenated] )
)

Then I create two new tables and it will give you what you want.

GroupedTable =
SUMMARIZE (
    'Table',
    'Table'[ITEM1],
    "ConcatenatedActs", CONCATENATEX ( 'Table', 'Table'[Concatenated], ", " )
)

vyilongmsft_2-1727060911261.png

Top5Concatenations =
TOPN (
    5,
    SUMMARIZE ( 'Table', 'Table'[Concatenated], "Count", 'Table'[Measure] ),
    [Count], DESC
)

vyilongmsft_3-1727060956160.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Almost a good solution

i try our idea with table and i have got the solution

 

and i try to do the same thing only in measure and the result is wrong.

it's my pbix to upload here : TOPN and CONCAT BY MEASURE 

chock974
Frequent Visitor
bhanu_gautam
Super User
Super User

@chock974 , Can you share data in a format that can be copied instead of picture




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.