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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Number of products with a rating upgrade/downgrade by Product Groups

Hello,
I have a table with Product Group (A and B), Product Names (Product1, Product2 and Product3) and Client Ratings (1=low, 2=medium, 3=good) for each product over several months (3 months in the sample table below)

 

Product GroupProductClient RatingRating Date
GroupAProduct1131/10/2020
GroupAProduct1130/11/2020
GroupAProduct1231/12/2020
GroupAProduct2231/10/2020
GroupAProduct2230/11/2020
GroupAProduct2331/12/2020
GroupBProduct3231/10/2020
GroupBProduct3130/11/2020
GroupBProduct3131/12/2020


I'm trying to calculate the number of products being upgraded (increase in rating) and downgraded (lower rating) on a reference date vs a comparison date with both dates being selected by the user.

 

The result for Reference date 31/12/2020 and Comparison date 31/10/2020 should look like this:

 

Product GroupNumUPNumDOWN
GroupA20
GroupB01

 

Thank you

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous ,

Try like these formula. Assume you have date table. You might use all or allselected in filter on date table

 

Group	NumUP =
 var _min = minxx(allselected(Date),Date[Date])
 var _max = minxx(allselected(Date),Date[Date])
 return 
 countx(filter(summarize(Table, Table[Group] ,Table[Product], "_1", calculate(max(Table[Client Rating]),filter(Date,Date[Date] =_min)),, "_2", calculate(max(Table[Client Rating]),filter(Date,Date[Date] =_max))),[_1]>[_2]),[Product])
 
 
 
  Group	NumDOWN =
 var _min = minxx(allselected(Date),Date[Date])
 var _max = minxx(allselected(Date),Date[Date])
 return 
 countx(filter(summarize(Table, Table[Group] ,Table[Product], "_1", calculate(max(Table[Client Rating]),filter(Date,Date[Date] =_min)),, "_2", calculate(max(Table[Client Rating]),filter(Date,Date[Date] =_max))),[_1]>[_2]),[Product])
lbendlin
Super User
Super User

Nearly there, just need to fix the totals.

 

First, create an unconnected calculated table that feeds the slicer

 

Slicer = VALUES(Ratings[Rating Date])

 

Then use something similar to this

 

lbendlin_0-1597714367392.png

 

Apart from the totals being wrong this also suffers from the uncertainty of what to do when a product does not have a rating value on one of the selected dates.

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors