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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
SwatKat
Frequent Visitor

Need help in choosing right Visual for showing Top 10 Accounts by Order count with multiple comments

HI , 

I have a scenario where i need to show Top 10 customers by Order count with comments . Comments will be placed on individual orders. I need to show the users in right way , so information can easily be interpreted. Currently I am concatenating all the comments that belong to an Account and showing in the same grid. But this can be done better. Please help if i can design this differently. I am short of ideas

 I have choosen a Table Visual with these columns. Below is how my table visual looks like

 

AccountNameOrder CountComments
Account1975Comment 1 ;Comment 2; Comment 3
Account2875Comment 1 ;Comment 2; Comment 3
Account3775Comment 1 ;Comment 2; Comment 3
Account4675Comment 1 ;Comment 2; Comment 3
Account5575Comment 1 ;Comment 2; Comment 3
Account6475Comment 1 ;Comment 2; Comment 3
Account7375Comment 1 ;Comment 2; Comment 3
Account8275Comment 1 ;Comment 2; Comment 3
Account9175Comment 1 ;Comment 2; Comment 3
Account1075Comment 1 ;Comment 2; Comment 3

 

Table Design

 

Account table
AccountIDAccount Name
1Account1
2Account2
3Account3
4Account4
5Account5
6Account6
7Account7
8Account8
9Account9
10Account10
Order Details
IDAccountIDOrder QuantityComments
1Account11Comment1
2Account21Comment1
3Account31Comment1
4Account11Comment2
5Account21Comment2
6Account31Comment2
7Account11Comment3
8Account21Comment3
9Account31Comment3
1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @SwatKat,

You can use the following measure formula with 'account' table 'account name' field, 'order detail' table 'comments' field with aggregate mode 'count' to create a table visual show the top 10 accounts and correspond comments:

formula =
VAR summary =
    TOPN (
        10,
        SUMMARIZE (
            ALLSELECTED ( 'Order Details' ),
            'Order Details'[AccountID],
            "CommentCount", COUNT ( 'Order Details'[Comments] )
        ),
        [CommentCount], DESC
    )
VAR currID =
    SELECTEDVALUE ( Account[AccountID] )
RETURN
    IF (
        currID IN SELECTCOLUMNS ( summary, "AccountID", [AccountID] ),
        CONCATENATEX (
            CALCULATETABLE (
                VALUES ( 'Order Details'[Comments] ),
                FILTER ( ALLSELECTED ( 'Order Details' ), [AccountID] = currID )
            ),
            [Comments],
            ","
        )
    )

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

HI @SwatKat,

You can use the following measure formula with 'account' table 'account name' field, 'order detail' table 'comments' field with aggregate mode 'count' to create a table visual show the top 10 accounts and correspond comments:

formula =
VAR summary =
    TOPN (
        10,
        SUMMARIZE (
            ALLSELECTED ( 'Order Details' ),
            'Order Details'[AccountID],
            "CommentCount", COUNT ( 'Order Details'[Comments] )
        ),
        [CommentCount], DESC
    )
VAR currID =
    SELECTEDVALUE ( Account[AccountID] )
RETURN
    IF (
        currID IN SELECTCOLUMNS ( summary, "AccountID", [AccountID] ),
        CONCATENATEX (
            CALCULATETABLE (
                VALUES ( 'Order Details'[Comments] ),
                FILTER ( ALLSELECTED ( 'Order Details' ), [AccountID] = currID )
            ),
            [Comments],
            ","
        )
    )

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors