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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bahare76
Helper I
Helper I

Calculate Average Rating

Dear colleagues,

I have a table that consists of ratings of 3 products. I wanted to present all the ratings on a single card in the PBI dashboard. I don't want to create three different measures for each product. You may refer the sample data and dashboard below. Appreciate your help.

Name Rating on Product ARating on Product BRating on Product C
Allan314
Raymer445
Johnson551
Donna124

 

bahare76_0-1645178515372.png

 

 

1 ACCEPTED SOLUTION

Hi @bahare76 ,

 

Click on the product A column chart and then dynamically get the results of the card, there is no way.

But you can create a slicer and select different products in the slicer to get different results.

 

1.Create a seperate table.

vstephenmsft_0-1645758227655.png

 

2.Create a measure.

Average Rating =
SWITCH (
    SELECTEDVALUE ( 'Table (2)'[Prduct] ),
    "Product A", AVERAGE ( 'Table'[Rating on Product A] ),
    "Product B", AVERAGE ( 'Table'[Rating on Product B] ),
    "Product C", AVERAGE ( 'Table'[Rating on Product C] )
)

 

The result is as follows.

vstephenmsft_1-1645758271185.pngvstephenmsft_2-1645758279214.png

 

Best Regards,

Stephen Tao

 

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

7 REPLIES 7
Tahreem24
Super User
Super User

@bahare76 If you want to do using measure so do like below:

Total Rating = SUM('Table'[Rating on Product A])
+SUM('Table'[Rating on Product B])
+SUM('Table'[Rating on Product C])
 
Capture.JPG
 
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Hi @Tahreem24 , what about average calculation?

@bahare76 Write AVERAGE instead of SUM in above measure.

 

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

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

@Tahreem24 

Sorry, perhaps I was not making myself clear. I actually wanted to show the Product's average rating on the card whenever I click each column chart. So, for instance, if I click Product A column chart, I will get its average. Similarly, for Product B and C.

Hi @bahare76 ,

 

Click on the product A column chart and then dynamically get the results of the card, there is no way.

But you can create a slicer and select different products in the slicer to get different results.

 

1.Create a seperate table.

vstephenmsft_0-1645758227655.png

 

2.Create a measure.

Average Rating =
SWITCH (
    SELECTEDVALUE ( 'Table (2)'[Prduct] ),
    "Product A", AVERAGE ( 'Table'[Rating on Product A] ),
    "Product B", AVERAGE ( 'Table'[Rating on Product B] ),
    "Product C", AVERAGE ( 'Table'[Rating on Product C] )
)

 

The result is as follows.

vstephenmsft_1-1645758271185.pngvstephenmsft_2-1645758279214.png

 

Best Regards,

Stephen Tao

 

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

Thejeswar
Resident Rockstar
Resident Rockstar

Hi @bahare76 ,

You can unpivot only the 3 product columns so that they apper as single column as shown below

Thejeswar_2-1645181574427.png

 

The Table will look as below

Thejeswar_1-1645181342872.png

You can use this value column in a simple card visual to get the Average across Products

amitchandak
Super User
Super User

@bahare76 , Unpivot the table, split the column on last space into two column and get Product

 

https://radacad.com/pivot-and-unpivot-with-power-bi
Split Column Power Query: https://youtu.be/FyO9Vmhcfag

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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