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
daechir7
New Member

On selection of a product from a product vs sales bar chart, I want to see top 3 user comments about

Let's say my dataset has few columns - Product, Sales & User Comments etc

I have created a bar chart product vs sales.

Now, if I select any bar, I should be able to see random sample comments about that product in a separate box.

Pretty new to powerbi, have searched for some time, unable to find any solution. Thanks in advance 🙂

Dataset example

Expected Output

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @daechir7 ,
sample data:

vyifanwmsft_1-1718677836331.png

 

You can modify your measure:

top3 comments = 
VAR _userfeedback = SELECTEDVALUE( 'Table'[User Feedback] )
VAR _rank =
    RANKX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Product Name] = SELECTEDVALUE ( 'Table'[Product Name] )
        ),
        CALCULATE ( MAX ( 'Table'[SL.No] ) ),
        ,
        ASC
    )
VAR _top3 = IF(_rank<=3,_userfeedback,BLANK())
RETURN
_top3
sample comments = 
    IF (
        ISFILTERED ( 'Table'[Product Name] ),
        CONCATENATEX ( 'Table', [top3 comments], " | " )
        ,
        "Please selected Product Name")

Final output:

vyifanwmsft_0-1718677805224.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

8 REPLIES 8
Anonymous
Not applicable

Hi @daechir7 ,

I think @Uzi2019 's reply is helpful. In the meantime, I am here to talk about my thinking. 

Maybe you can use Card visual to achieve your goals, I created a sample data for you:

Sample data:

vyifanwmsft_0-1718346501323.png

1.Add new measures.

Description =
IF (
    ISFILTERED ( 'Table'[Product Name] ),
    SELECTEDVALUE ( 'Table'[Product Description] ),
    "Please selected Product Name"
)
samlpe comments = 
VAR _rank =
    RANKX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Product Name] = SELECTEDVALUE ( 'Table'[Product Name] )
        ),
        CALCULATE ( MAX ( 'Table'[SL.No] ) ),
        ,
        DESC
    )
RETURN
    IF (
        ISFILTERED ( 'Table'[Product Name] ),
        CALCULATE (
            CONCATENATEX ( 'Table', 'Table'[User Feedback], " / " ),
            FILTER ( 'Table', _rank <= 3 )
        ),
        "Please selected Product Name"
    )

2.Put two measures in the card.

vyifanwmsft_1-1718347209324.png

vyifanwmsft_2-1718347244764.png

 

 Final output:

vyifanwmsft_3-1718347311436.png

 

vyifanwmsft_4-1718347340490.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

Hi @Anonymous , This is pretty close and exactly how I needed this, there's a slight change in the dataset now 😞 I would need at least 3 comments to show up which are in a single row, separated by a pipe '|' Adding an updated screenshot - ibb.co/ctxHkbX So, if i select the product, it must show the first 3 comments separated by pipe. Sorry, the data I am working with, the layout got changed 😞 

So, store column isn't there anymore. One row for one product and comments are separated by pipe '|'. First 3 comments will work. 

I truly appreciate your help and apolgies for the inconvenience. 

Anonymous
Not applicable

Hi @daechir7 ,
sample data:

vyifanwmsft_1-1718677836331.png

 

You can modify your measure:

top3 comments = 
VAR _userfeedback = SELECTEDVALUE( 'Table'[User Feedback] )
VAR _rank =
    RANKX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Product Name] = SELECTEDVALUE ( 'Table'[Product Name] )
        ),
        CALCULATE ( MAX ( 'Table'[SL.No] ) ),
        ,
        ASC
    )
VAR _top3 = IF(_rank<=3,_userfeedback,BLANK())
RETURN
_top3
sample comments = 
    IF (
        ISFILTERED ( 'Table'[Product Name] ),
        CONCATENATEX ( 'Table', [top3 comments], " | " )
        ,
        "Please selected Product Name")

Final output:

vyifanwmsft_0-1718677805224.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

This works perfectly, thank you so much 🙂

Uzi2019
Super User
Super User

Hi @daechir7 

 

You can use tooltip feature on product vs sales chart. follow these video for better understnding.

https://www.youtube.com/watch?v=k0cwSYNXhkI

https://www.youtube.com/watch?v=a5HlBrBygVE

https://www.youtube.com/watch?v=rxtuYqMZsZg

 

I hope this may help to set tooltip with top 3 comments by sales.

add table in your tooltip page and comments and other fileds you want

just use visual filter > top n >3 > put values > sales 

Uzi2019_0-1718273684021.png

 

Uzi2019_1-1718273731455.png

 

 

I hope i answered your question!

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Hi @Uzi2019 , thanks for your response. However, I am specifically looking to show up the comments in a text box instead of the tooltip. The Default text must say as it is in the output boxes and should show the description in one box and comments in the other box when a bar is selected. 

But if I don't find a solution to my expectation, then I will utilize the one you have shared. 🙂

 @daechir7 

 

You can add simple table add comments and seperate table add description. when you select somthing on chart it auto filters the tables values( comments and description).

 

other wise there is nothing much I can suggest.. 
tooltip is actually a good feature that you can utilized.

 

I hope i answered your query.

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Thanks @Uzi2019 for another great alternative. I'd still keep it open and see if the exact thing could be done. 🙂

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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