Forum Discussion

ehealthpartners's avatar
ehealthpartners
New Member
6 years ago
Solved

Commission Report Calculations

Hello,

 

I am trying to build a commission report in Power BI. Our commissions payout is divided so a sales rep get 60% of their commission right after the sale and the remaining 40% 90 days after. I already calculated both payout amounts but am struggling trying to display the backlog amount to be paid for a set period. So for example:

 

Sales rep A made a $500 commission back on March, the payout would be $300 initially and the remaining $200 in June.

Same sales rep A now made another $1,000 commission in June. So the June payout would be $800 ($600 from the June commission and the remaining $200 back from March).

 

I am trying to display a Table/Matrix and a Filter which shows as follows:

 

Filter: 6/1/2020 to 6/30/2020

 

Table:

 

Sales RepCommission60% PayoutRemaining 40% Payout (from 90 days ago commission)Total Commission Paid
A$1,000.00$600.00$200.00$800.00

 

I'm struggling trying to display the Remaining 40% and Total columns. Any help would be greatly appreciated.

 

Thank you

  • Hi, ehealthpartners 

     

    Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

     

    Table:

     

    Calendar(a calculated table):

     

    Calendar = CALENDARAUTO()

     

     

    There is no relationship between two tables. You may create calculated columns and measures as below.

     

    Calculated Column:
    Year-Month = FORMAT('Calendar'[Date],"yyyy-mm")
    Year-Month current = FORMAT('Table'[Date],"yyyy-mm")
    Year-Month 90 days later = FORMAT('Table'[40% 90 days after sale date],"yyyy-mm")

     

     

     

    Measure:
    Sales = 
    var tab = 
    SUMMARIZE(
        'Table',
        'Table'[SaleRep],
        "Sales",
        var _salerep = [SaleRep]
        return
        CALCULATE(
            SUM('Table'[SalesTotal]),
            FILTER(
                ALL('Table'),
                'Table'[Year-Month current] in DISTINCT('Calendar'[Year-Month])&&
                'Table'[SaleRep] = _salerep
            )
        )
    )
    return
    SUMX(
        tab,
        [Sales]
    )
    
    Commssion = 
    var tab = 
    SUMMARIZE(
        'Table',
        'Table'[SaleRep],
        "Commission",
        var _salerep = [SaleRep]
        return
        CALCULATE(
            SUM('Table'[Commission]),
            FILTER(
                ALL('Table'),
                'Table'[Year-Month current] in DISTINCT('Calendar'[Year-Month])&&
                'Table'[SaleRep] = _salerep
            )
        )
    )
    return
    SUMX(
        tab,
        [Commission]
    )
    
    1st Payment 60% = 
    var tab = 
    SUMMARIZE(
        'Table',
        'Table'[SaleRep],
        "0.6 Sales",
        var _salerep = [SaleRep]
        return
        CALCULATE(
            SUM('Table'[0.6]),
            FILTER(
                ALL('Table'),
                'Table'[Year-Month current] in DISTINCT('Calendar'[Year-Month])&&
                'Table'[SaleRep] = _salerep
            )
        )
    )
    return
    SUMX(
        tab,
        [0.6 Sales]
    )
    
    2nd Payment 40% 90 days prior = 
    var tab = 
    SUMMARIZE(
        'Table',
        'Table'[SaleRep],
        "0.4 Sales",
        var _salerep = [SaleRep]
        return
        CALCULATE(
            SUM('Table'[0.4]),
            FILTER(
                ALL('Table'),
                'Table'[Year-Month 90 days later] in DISTINCT('Calendar'[Year-Month])&&
                'Table'[SaleRep] = _salerep
            )
        )
    )
    var _result = 
    SUMX(
        tab,
        [0.4 Sales]
    )
    return
    IF(
        ISBLANK(_result),
        0,
        _result
    )
    
    Total Commission Paid = [1st Payment 60%]+[2nd Payment 40% 90 days prior]

     

     

    Finally you may use the 'Year-Month' column from 'Calendar' table to filter the result.

     

     

    Best Regards

    Allan

     

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

3 Replies

    • ehealthpartners's avatar
      ehealthpartners
      New Member

      This is the sample output in table format

      Sample Report

       

      The sample data

      Sample Source Data

  • v-alq-msft's avatar
    v-alq-msft
    Community Support

    Hi, ehealthpartners 

     

    Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

     

    Table:

     

    Calendar(a calculated table):

     

    Calendar = CALENDARAUTO()

     

     

    There is no relationship between two tables. You may create calculated columns and measures as below.

     

    Calculated Column:
    Year-Month = FORMAT('Calendar'[Date],"yyyy-mm")
    Year-Month current = FORMAT('Table'[Date],"yyyy-mm")
    Year-Month 90 days later = FORMAT('Table'[40% 90 days after sale date],"yyyy-mm")

     

     

     

    Measure:
    Sales = 
    var tab = 
    SUMMARIZE(
        'Table',
        'Table'[SaleRep],
        "Sales",
        var _salerep = [SaleRep]
        return
        CALCULATE(
            SUM('Table'[SalesTotal]),
            FILTER(
                ALL('Table'),
                'Table'[Year-Month current] in DISTINCT('Calendar'[Year-Month])&&
                'Table'[SaleRep] = _salerep
            )
        )
    )
    return
    SUMX(
        tab,
        [Sales]
    )
    
    Commssion = 
    var tab = 
    SUMMARIZE(
        'Table',
        'Table'[SaleRep],
        "Commission",
        var _salerep = [SaleRep]
        return
        CALCULATE(
            SUM('Table'[Commission]),
            FILTER(
                ALL('Table'),
                'Table'[Year-Month current] in DISTINCT('Calendar'[Year-Month])&&
                'Table'[SaleRep] = _salerep
            )
        )
    )
    return
    SUMX(
        tab,
        [Commission]
    )
    
    1st Payment 60% = 
    var tab = 
    SUMMARIZE(
        'Table',
        'Table'[SaleRep],
        "0.6 Sales",
        var _salerep = [SaleRep]
        return
        CALCULATE(
            SUM('Table'[0.6]),
            FILTER(
                ALL('Table'),
                'Table'[Year-Month current] in DISTINCT('Calendar'[Year-Month])&&
                'Table'[SaleRep] = _salerep
            )
        )
    )
    return
    SUMX(
        tab,
        [0.6 Sales]
    )
    
    2nd Payment 40% 90 days prior = 
    var tab = 
    SUMMARIZE(
        'Table',
        'Table'[SaleRep],
        "0.4 Sales",
        var _salerep = [SaleRep]
        return
        CALCULATE(
            SUM('Table'[0.4]),
            FILTER(
                ALL('Table'),
                'Table'[Year-Month 90 days later] in DISTINCT('Calendar'[Year-Month])&&
                'Table'[SaleRep] = _salerep
            )
        )
    )
    var _result = 
    SUMX(
        tab,
        [0.4 Sales]
    )
    return
    IF(
        ISBLANK(_result),
        0,
        _result
    )
    
    Total Commission Paid = [1st Payment 60%]+[2nd Payment 40% 90 days prior]

     

     

    Finally you may use the 'Year-Month' column from 'Calendar' table to filter the result.

     

     

    Best Regards

    Allan

     

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