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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
adj87
Helper I
Helper I

Conditional Approximate Lookups

Hi Everyone,

I could really use some help here. I have lots of experience with Excel but I am relatively new to PowerBI.

 

I have a series of performance data (sales figures for employees at various levels, Entry Level, Professional, Senior, etc.) and the plans they are tallied against those levels:

 

Sales (Entry Level)Points
$00 pts
$10005 pts
$250010 pts

 

Table above is 1 of 4 metrics for 1 of 5 job titles.

 

I currently have a table in Excel using UDFs full of Case/IFs for all this, but I want to transform that into PowerBI. My first thought was R/Python, but I am not familiar with those languages. My last straw idea is to create tables for each job title, but that almost defeats the purpose of automation since our titles do change/evolve every few years.

 

Any help/direction would be great, thanks!

1 ACCEPTED SOLUTION

Hi @adj87 ,

 

I think you need to create the following tables in Power BI.

  • Job - A table containing all the job names.
  • FactTable - A table containing sales and starts data.
  • Points - A table with rules for converting sales and starts to points.
  • Payment - A table with rules for converting points to payment.

 

vkkfmsft_6-1639633037059.png    vkkfmsft_2-1639632798834.png

vkkfmsft_0-1639632718568.png  vkkfmsft_1-1639632762652.png

 

Then add the "End" columns to table Points and table Payment, indicating that the sales/starts/points data between the Values Start/Points Start and the Values End/Points End can be converted to the corresponding points/payment.

 

vkkfmsft_3-1639632919807.png

vkkfmsft_4-1639632954418.png

 

If you import the table from Excel file in the following form, then you need to do some conversions to transform it to table Points and table Payment. Please refer to the attachment for the steps and code.

 

vkkfmsft_5-1639632979988.png

 

Then create the following relationships and measures.

 

vkkfmsft_7-1639634040366.png

SumSales = SUM(FactTable[Sales])
Sales_Points = 
CALCULATE (
    MAX ( Points[Points] ),
    FILTER (
        Points,
        Points[Category] = "Sales"
            && Points[Values Start] <= [SumSales]
            && Points[Values End] > [SumSales]
    )
)
Starts_Points = 
CALCULATE (
    MAX ( Points[Points] ),
    FILTER (
        Points,
        Points[Category] = "Starts"
            && Points[Values Start] <= [SumSales]
            && Points[Values End] > [SumSales]
    )
)
TotalPoints = value( SUBSTITUTE( [Sales_Points], "pts", "" ) ) + value( SUBSTITUTE( [Starts_Points], "pts", "" ) )
Payment = 
CALCULATE (
    MAX ( Payment[Payment] ),
    FILTER (
        Payment,
        Payment[Points End] > [TotalPoints]
            && Payment[Points Start] <= [TotalPoints]
    )
)

vkkfmsft_8-1639634184176.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

6 REPLIES 6
adj87
Helper I
Helper I

Apologies for the abiguity, you always know every facet of your data until you bring in an outside party ... Hopefully this example helps. I've pasted example data/plans here (Forgive me for the endless string of data, I didn't know any other way to send it). The idea being each employee is bonused on Sales/Starts. Those figures are then converted to "Points" and the points factor into the overall payment (among many other things). All these metrics are based on title and in some cases time in the company.

 

(Plan to follow in second message... this message exceeds 20k characters)

 

Thank you!

 

YearQuarterJob TitleSalesStarts
2020Q1Entry A48849
2020Q1Entry A16650
2020Q1Entry A80993
2020Q1Entry B559813
2020Q1Entry B413416
2020Q1Entry B17943
2020Q1Professional61603
2020Q1Professional13129
2020Q1Professional486020
2020Q1Senior82346
2020Q1Senior92899
2020Q1Senior800614
2020Q2Entry A386612
2020Q2Entry A21884
2020Q2Entry A775110
2020Q2Entry B139114
2020Q2Entry B36877
2020Q2Entry B2035
2020Q2Professional487715
2020Q2Professional90246
2020Q2Professional74071
2020Q2Senior43197
2020Q2Senior535420
2020Q2Senior104918
2020Q3Entry A774912
2020Q3Entry A32815
2020Q3Entry A402
2020Q3Entry B53975
2020Q3Entry B170512
2020Q3Entry B749216
2020Q3Professional589612
2020Q3Professional39491
2020Q3Professional444717
2020Q3Senior666610
2020Q3Senior914
2020Q3Senior673011
2020Q4Entry A34417
2020Q4Entry A20574
2020Q4Entry A30481
2020Q4Entry B16465
2020Q4Entry B396116
2020Q4Entry B58867
2020Q4Professional63518
2020Q4Professional77837
2020Q4Professional56887
2020Q4Senior668916
2020Q4Senior82019
2020Q4Senior30786

 

Entry A - Sales 
00 pts
10005 pts
250010 pts
500015 pts
Entry B - Sales 
00 pts
30005 pts
500010 pts
750015 pts
Professional - Sales 
00 pts
50005 pts
750010 pts
1000015 pts
Senior - Sales 
00 pts
50005 pts
750010 pts
1000015 pts
Entry A - Starts 
00 pts
2.55 pts
510 pts
7.515 pts
Entry B - Starts 
00 pts
55 pts
7.510 pts
1015 pts
Professional - Starts 
00 pts
55 pts
7.510 pts
1015 pts
Senior - Starts 
00 pts
105 pts
1510 pts
2015 pts
Entry A / Entry B - Points
00
20Payment
Professional / Senior - Points
00
20Payment
30Double Payment

Hi @adj87 ,

 

I think you need to create the following tables in Power BI.

  • Job - A table containing all the job names.
  • FactTable - A table containing sales and starts data.
  • Points - A table with rules for converting sales and starts to points.
  • Payment - A table with rules for converting points to payment.

 

vkkfmsft_6-1639633037059.png    vkkfmsft_2-1639632798834.png

vkkfmsft_0-1639632718568.png  vkkfmsft_1-1639632762652.png

 

Then add the "End" columns to table Points and table Payment, indicating that the sales/starts/points data between the Values Start/Points Start and the Values End/Points End can be converted to the corresponding points/payment.

 

vkkfmsft_3-1639632919807.png

vkkfmsft_4-1639632954418.png

 

If you import the table from Excel file in the following form, then you need to do some conversions to transform it to table Points and table Payment. Please refer to the attachment for the steps and code.

 

vkkfmsft_5-1639632979988.png

 

Then create the following relationships and measures.

 

vkkfmsft_7-1639634040366.png

SumSales = SUM(FactTable[Sales])
Sales_Points = 
CALCULATE (
    MAX ( Points[Points] ),
    FILTER (
        Points,
        Points[Category] = "Sales"
            && Points[Values Start] <= [SumSales]
            && Points[Values End] > [SumSales]
    )
)
Starts_Points = 
CALCULATE (
    MAX ( Points[Points] ),
    FILTER (
        Points,
        Points[Category] = "Starts"
            && Points[Values Start] <= [SumSales]
            && Points[Values End] > [SumSales]
    )
)
TotalPoints = value( SUBSTITUTE( [Sales_Points], "pts", "" ) ) + value( SUBSTITUTE( [Starts_Points], "pts", "" ) )
Payment = 
CALCULATE (
    MAX ( Payment[Payment] ),
    FILTER (
        Payment,
        Payment[Points End] > [TotalPoints]
            && Payment[Points Start] <= [TotalPoints]
    )
)

vkkfmsft_8-1639634184176.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

Thank you! This is a great help. I've applied these examples to my main workbook.

 

Your attached/measures above for Starts_Points references "SumSales" so I added another measure "SumStarts". I adjust the attached model with this change, and everyone calculated correctly.

 

adj87_0-1639681573886.png

I did notice a odd error. I fat fingered 1 of the point tables so that a Professional Recruiter would get 3 pts at the 0-11 and 0-8 ranges depending on group.

 

adj87_1-1639682952115.png

 

This error caused everyone, regardless of title, to recieve at least 3 pts (I've corrected it above). Based on my limited understanding of the formulas used here, I didn't think that would occur. I assume this has something to do with the relationship linking Job Title/rest of the tables and the "order of operations" for lack of a better term (measure applied first then the relationship for example). Any light shed on this would be helpful so I can find a way to better avoid errors like this.

Thank you!

Hi @adj87 ,

 

This is because the measure [Starts_Points] does not filter the Group column, which means that in the existing model, if the Starts value is 9, then the "FILTER" function will filter out the rows: "0  11  0" and "8  10  3". Then it will calculate the maximum value of the Points column from these two rows, which is 3.

 

vkkfmsft_0-1639733461413.png


So if your FactTable and Points table both contain the Group columns, you need to add this inactive relationship to the model.

 

vkkfmsft_1-1639733612458.png

 

Then modify the measure.

 

Starts_Points = 
CALCULATE (
    MAX ( Points[Points] ),
    FILTER (
        Points,
        Points[Category] = "Starts"
            && Points[Values Start] <= [SumStarts]
            && Points[Values End] > [SumStarts]
    ),
    USERELATIONSHIP ( FactTable[Group], Points[Group] )
)

result.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

That did it, thank you! I thought I could get away with adding additional relationships just like with Job Title table, so I had this initially. Forgive me, Payment/LS_Payment are not well named, they should be:

Payment -> Payment_A

LS_Payment -> Payment_B

 

adj87_0-1639745569238.png

 

Now I have this, the FactTable[Group],Points[Group] relationship is a Many/Many, but doing an random sampling, the data does seem to calculate correctly, so I don't know if this is necessarily a bad thing in this situation.

 

adj87_1-1639745702807.png

 

AlexisOlson
Super User
Super User

Can you give some example data and the result you're expecting? I'm not really sure what kind of response you're looking for here.

 

How to Get Your Question Answered Quickly

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.