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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
jasmin_w
Frequent Visitor

Calculated Column, 2 sets of calculations based on ID# from another table

I am trying to create a calculated column, but I need to do 2 different calculations based on ID number. I have a table of the Exempt ID numbers, a table with the Employee data, and a table that contains the actual data values. 

 

Table Names

Exempt Employees - table that includes ID numbers that I want to do a different calculation for.

Employee Data - table that contains employee information and connects all the data sources

Main - table that includes the data values by employee number.

 

Pretty much, I want to have 2 sets of calculations based on if their ID number is in the Exempt Employee Table.

  • If ID in Exempt Employee then 
    • 'Main'[Base Salary] * 'Main'[Multiplier]  / 4
  • If ID not in Exempt Employees then 
    • ('Main'[Base Salary] * 'Main'[Multiplier]) * 0.8 )) / 4

What is the best way to do this? I can also change the relationships between the 3 tables if there is a solution that way too.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jasmin_w 

 

For your question, here is the method I provided:

 

Here's some dummy data

 

“Exempt Employees”

vnuocmsft_0-1710380648948.png

 

“Employee”

vnuocmsft_1-1710380661168.png

 

“Main”

vnuocmsft_2-1710380674392.png

 

Relationships between tables.

vnuocmsft_3-1710380736730.png

 

Create a Calculated Column. This function queries whether the ID returned from the Exempt Employees table is a relevant value indicating that the employee is exempt.

 

Salary Calculation = 
    var _isExempt = 
        NOT(
            ISBLANK(
                RELATED('Exempt Employees'[ID])
            )
        )
RETURN 
    IF(
        _isExempt,
        ('Main'[Base Salary] * 'Main'[Multiplier] * 0.8) / 4, 
        ('Main'[Base Salary] * 'Main'[Multiplier] ) / 4
    )

 

Here is the result.

 

vnuocmsft_4-1710381062479.png

 

Regards,

Nono Chen

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

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

In which of those 3 tables do you want to write those formulas?  Share the download link of the PBI file.


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

Hi @jasmin_w 

 

For your question, here is the method I provided:

 

Here's some dummy data

 

“Exempt Employees”

vnuocmsft_0-1710380648948.png

 

“Employee”

vnuocmsft_1-1710380661168.png

 

“Main”

vnuocmsft_2-1710380674392.png

 

Relationships between tables.

vnuocmsft_3-1710380736730.png

 

Create a Calculated Column. This function queries whether the ID returned from the Exempt Employees table is a relevant value indicating that the employee is exempt.

 

Salary Calculation = 
    var _isExempt = 
        NOT(
            ISBLANK(
                RELATED('Exempt Employees'[ID])
            )
        )
RETURN 
    IF(
        _isExempt,
        ('Main'[Base Salary] * 'Main'[Multiplier] * 0.8) / 4, 
        ('Main'[Base Salary] * 'Main'[Multiplier] ) / 4
    )

 

Here is the result.

 

vnuocmsft_4-1710381062479.png

 

Regards,

Nono Chen

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

 

 

Thank you so much. This worked perfectly!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.