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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
kristina-brooly
Frequent Visitor

users rating excluding users registered less then 3 months ago

Hello, please help me to calculate users rating

 

«users rating» = «sales rank» * 0.75 + «bonus rank» * 0.25

«sales rank» and  «bonus rank» — ranging sales growth in % (last month to a month before that (2 months ago)

Its August now so we need to calculate % growth June/July.

 

User is included to this calculation if he's been registered more then 3 months ago (current month excluded).

 

Tables

Users

  • user_id
  • name 
  • registration_date

Sales

  • month_code – year and month in YYYYMM format
  • user_id 
  •  sale  
  •  bonus 

Need to make a table like this: 

 

UserSalesBonusAverage rating
Name100000020000001,3
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @kristina-brooly ,

 

Here I create a sample to have a test.

User:

vrzhoumsft_0-1693205256029.png

Sales:

vrzhoumsft_1-1693205262547.png

Measure:

Average Rating = 
VAR _LASTMONTH =
    EOMONTH ( TODAY (), -1 )
VAR _2MONTHAGO =
    EOMONTH ( TODAY (), -2 )
VAR _Salesrank =
    CALCULATE (
        DIVIDE (
            CALCULATE (
                SUM ( Sales[sale] ),
                FILTER (
                    Sales,
                    Sales[month_code]
                        = YEAR ( _LASTMONTH ) * 100
                            + MONTH ( _LASTMONTH )
                )
            ),
            CALCULATE (
                SUM ( Sales[sale] ),
                FILTER (
                    Sales,
                    Sales[month_code]
                        = YEAR ( _2MONTHAGO ) * 100
                            + MONTH ( _2MONTHAGO )
                )
            )
        ),
        FILTER ( User, User[registration_date] <= EOMONTH ( TODAY (), -4 ) + 1 )
    )
VAR _Bonusrank =
    CALCULATE (
        DIVIDE (
            CALCULATE (
                SUM ( Sales[bonus] ),
                FILTER (
                    Sales,
                    Sales[month_code]
                        = YEAR ( _LASTMONTH ) * 100
                            + MONTH ( _LASTMONTH )
                )
            ),
            CALCULATE (
                SUM ( Sales[bonus] ),
                FILTER (
                    Sales,
                    Sales[month_code]
                        = YEAR ( _2MONTHAGO ) * 100
                            + MONTH ( _2MONTHAGO )
                )
            )
        ),
        FILTER ( User, User[registration_date] <= EOMONTH ( TODAY (), -4 ) + 1 )
    )
RETURN
    _Salesrank * 0.75 + _Bonusrank * 0.25
Filter = 
IF(MAX(User[registration_date])<=EOMONTH(TODAY(),-4)+1,1,0)

Add [Filter] measure into visual level filter and set it to show items when value =1. Result is as below.

vrzhoumsft_2-1693205308179.png

 

Best Regards,

Rico Zhou

 

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

2 REPLIES 2
kristina-brooly
Frequent Visitor

please help)))

Anonymous
Not applicable

Hi @kristina-brooly ,

 

Here I create a sample to have a test.

User:

vrzhoumsft_0-1693205256029.png

Sales:

vrzhoumsft_1-1693205262547.png

Measure:

Average Rating = 
VAR _LASTMONTH =
    EOMONTH ( TODAY (), -1 )
VAR _2MONTHAGO =
    EOMONTH ( TODAY (), -2 )
VAR _Salesrank =
    CALCULATE (
        DIVIDE (
            CALCULATE (
                SUM ( Sales[sale] ),
                FILTER (
                    Sales,
                    Sales[month_code]
                        = YEAR ( _LASTMONTH ) * 100
                            + MONTH ( _LASTMONTH )
                )
            ),
            CALCULATE (
                SUM ( Sales[sale] ),
                FILTER (
                    Sales,
                    Sales[month_code]
                        = YEAR ( _2MONTHAGO ) * 100
                            + MONTH ( _2MONTHAGO )
                )
            )
        ),
        FILTER ( User, User[registration_date] <= EOMONTH ( TODAY (), -4 ) + 1 )
    )
VAR _Bonusrank =
    CALCULATE (
        DIVIDE (
            CALCULATE (
                SUM ( Sales[bonus] ),
                FILTER (
                    Sales,
                    Sales[month_code]
                        = YEAR ( _LASTMONTH ) * 100
                            + MONTH ( _LASTMONTH )
                )
            ),
            CALCULATE (
                SUM ( Sales[bonus] ),
                FILTER (
                    Sales,
                    Sales[month_code]
                        = YEAR ( _2MONTHAGO ) * 100
                            + MONTH ( _2MONTHAGO )
                )
            )
        ),
        FILTER ( User, User[registration_date] <= EOMONTH ( TODAY (), -4 ) + 1 )
    )
RETURN
    _Salesrank * 0.75 + _Bonusrank * 0.25
Filter = 
IF(MAX(User[registration_date])<=EOMONTH(TODAY(),-4)+1,1,0)

Add [Filter] measure into visual level filter and set it to show items when value =1. Result is as below.

vrzhoumsft_2-1693205308179.png

 

Best Regards,

Rico Zhou

 

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

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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