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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Progression calculation

Hello everyone!

 

The Brazilian government has adopted a progressive table for the collection of social security contributions. The rates are as follows.

 

Contribution SalaryRate
Until R$ 1.045,007,5%
From R$ 1.045,01 to R$ 2.089,609%
From R$ 2.089,61 to R$ 3.134,4012%
From R$ 3.134,41 to R$ 6.101,0614%

 

Between each installment, the calculation is made considering the maximum and minimum of these and the rate to be applied. While the salary amount is not reached, it is considered the salary cap.

Here's how is the calculation for a salary of R$ 3,000.00 as an example, which is in the third track:

- 1st salary range: 1,045.00 x 0.075 = 78.38
- 2nd salary range: [2,089.60 - 1,045.00] x 0.09 = 1,044.60 x 0.09 = 94.01
- Salary range: [3,000.00 - 2,089.60] x 0.12 = 910.40 x 0.12 = 109.25
- Total to be collected: 109.25 + 94.01 + 78.38 = 281.64

With this result it is possible to calculate the effective rate that is about 9.39% (281.64 ÷ 3,000.00).

 

So, i would like to create a measure capable of doing this calculation. Can someone help me please?

 

Thank you!

 

Luis

3 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

@Anonymous - You basically need to implement a WHILE loop in DAX, here is how: https://community.powerbi.com/t5/Quick-Measures-Gallery/While-Loop/m-p/637535#M320



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

v-shex-msft
Community Support
Community Support

HI @Anonymous,

Please split your contribution salary to two fields based on 'to' character and remove others not used text strings, then you can write a measure formula to calculate on them.

Measure = 
VAR summary =
    SUMMARIZE (
        'Table',
        [Contribution Salary From],
        [Contribution Salary To],
        [Rate],
        "Result", ( [Contribution Salary To] - [Contribution Salary From] ) * [rate]
    )
RETURN
    SUMX ( summary, [Result] )

5.png

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

You may refer to my solution - Compute transaction fee based on a tiered pricing model.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

You may refer to my solution - Compute transaction fee based on a tiered pricing model.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-shex-msft
Community Support
Community Support

HI @Anonymous,

Please split your contribution salary to two fields based on 'to' character and remove others not used text strings, then you can write a measure formula to calculate on them.

Measure = 
VAR summary =
    SUMMARIZE (
        'Table',
        [Contribution Salary From],
        [Contribution Salary To],
        [Rate],
        "Result", ( [Contribution Salary To] - [Contribution Salary From] ) * [rate]
    )
RETURN
    SUMX ( summary, [Result] )

5.png

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Asac_14
Resolver I
Resolver I

Hi @Anonymous  Here is the measure to compute effective rate - 

Effective Rate =
Var Sal=SUM('Salary'[Salary])
Var Total=IF(Sal>3134.41,(1045*0.075)+(1044.60*0.09)+(1044.79*0.12)+(Sal-3134.41)*0.14,IF(Sal>2089.61,(1045*0.075)+(1044.60*0.09)+(Sal-2089.61)*0.12,IF(Sal>1045.01,(1045*0.075)+(Sal-1045.01)*0.09,(Sal-1045)*0.75)))
Return
DIVIDE(Total,Sal)
 

ScreenshotScreenshot

Replace with your table and field name. Pls accept it as solution if it solves your problem. Kudos are welcome as well 😉

 

Thanks & Regards,

KK

+91-9940-28-4669

Greg_Deckler
Super User
Super User

@Anonymous - You basically need to implement a WHILE loop in DAX, here is how: https://community.powerbi.com/t5/Quick-Measures-Gallery/While-Loop/m-p/637535#M320



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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