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
Anonymous
Not applicable

Calculate Weighted Score for each Account by month

I  am trying to calculate score for each account by giving weights to previous scores

 

AccountScoreDate
x11/1/2018
x22/1/2018
x33/1/2018
x44/1/2018
x55/1/2018
y21/1/2018
y32/1/2018
y43/1/2018
y24/1/2018
y15/1/2018

 

 

Table I have

 

What I want

 

AccountWeightedScore
x5
y

10

 

Where  WeightedScore = 0.9*(Most recent Score by date i.e (5/1/2018)  ->  5) + 0.4(Next most recent score by date i.e (4/1/2018) -> 4)  ............................. and so on  ---- only for last 5 months

 

 

Thank you for Your Help.

1 ACCEPTED SOLUTION

I see now. So you need to build the below model:

 

download the file: https://1drv.ms/u/s!AiiWkkwHZChHjzkDSa4OQLU-JEcu

 

Capture.PNGCapture1.PNG

 Capture.PNG

 

Measure =
IF (
    HASONEVALUE ( Accounts[Account] ),
    VAR AddScore =
        ADDCOLUMNS (
            SUMMARIZE ( Scores, 'Calendar'[Year Month] ),
            "Score", CALCULATE ( MAX ( Scores[Score] ) )
        )
    VAR Top5 =
        TOPN ( 5, AddScore, 'Calendar'[Year Month], DESC )
    VAR WeightedScore =
        SUMX (
            Top5,
            VAR CurMonth = [Year Month]
            VAR Rnk =
                RANKX ( Top5, [Year Month], CurMonth, DESC )
            RETURN
                [Score]
                    * CALCULATE ( VALUES ( Weights[Weight] ), Weights[Recent] = Rnk )
        )
    RETURN
        WeightedScore
)

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

View solution in original post

6 REPLIES 6
LivioLanzo
Solution Sage
Solution Sage

If the most recent score has a weight of 0.9 and the second most recent score has a weight of 0.4, what is the weight of the other 3 ?

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Anonymous
Not applicable

0.2, 0.15, 0.5 I am just making them up, the Idea is to use 5 different weights which add up to 1.

With these wights, I am getting 7.5 instead of 5:

 

Capture.PNG

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Anonymous
Not applicable

you are right That's because I did not calculate it I was just making up the values, I wanted the logic that will get me From A - B   

I see now. So you need to build the below model:

 

download the file: https://1drv.ms/u/s!AiiWkkwHZChHjzkDSa4OQLU-JEcu

 

Capture.PNGCapture1.PNG

 Capture.PNG

 

Measure =
IF (
    HASONEVALUE ( Accounts[Account] ),
    VAR AddScore =
        ADDCOLUMNS (
            SUMMARIZE ( Scores, 'Calendar'[Year Month] ),
            "Score", CALCULATE ( MAX ( Scores[Score] ) )
        )
    VAR Top5 =
        TOPN ( 5, AddScore, 'Calendar'[Year Month], DESC )
    VAR WeightedScore =
        SUMX (
            Top5,
            VAR CurMonth = [Year Month]
            VAR Rnk =
                RANKX ( Top5, [Year Month], CurMonth, DESC )
            RETURN
                [Score]
                    * CALCULATE ( VALUES ( Weights[Weight] ), Weights[Recent] = Rnk )
        )
    RETURN
        WeightedScore
)

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Anonymous
Not applicable

Thanks a Lot, That was really helpful! 

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.