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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
v-yilong-msft
Community Support
Community Support

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
v-yilong-msft
Community Support
Community Support

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.