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
daveinitiv
Frequent Visitor

Calculate Vlookp "TRUE" with DAX

Hi all,

 

is there a way to perform a VLOOKP "TRUE" calculation in DAX?

 

I want to solve the following problem. A list of salaries should be classified in the right tax bracket to assign the correct tax rate.

 

BracketTax Rate
0-20.0000%
20.000-40.00025%
40.000-60.00035%
60.000-80.00045%
> 80.00050%

 

An employee with a salary of 50.000 should be assigned 35%, for example.

How would I do this in DAX? 

 

Many thanks for your help!

 

BR

David

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Hi, @daveinitiv , the answer to your question in such a case, is definitely YES!

A very small reshape of rate hierarchy helps do the trick.

Screenshot 2020-10-22 100242.png

Then it's a easy job to leverage DAX to achieve the goal. You might refer to the attach file for more details.

 

VLOOKUP TRUE = MINX( FILTER(Rates, Rates[UpperBound] > MAX( Emp[Salary] ) ), Rates[Tax Rate] )

 

Screenshot 2020-10-22 100612.png

Btw, Power Query is able to do the trick easily.

Screenshot 2020-10-22 103016.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

Hi, @daveinitiv , the answer to your question in such a case, is definitely YES!

A very small reshape of rate hierarchy helps do the trick.

Screenshot 2020-10-22 100242.png

Then it's a easy job to leverage DAX to achieve the goal. You might refer to the attach file for more details.

 

VLOOKUP TRUE = MINX( FILTER(Rates, Rates[UpperBound] > MAX( Emp[Salary] ) ), Rates[Tax Rate] )

 

Screenshot 2020-10-22 100612.png

Btw, Power Query is able to do the trick easily.

Screenshot 2020-10-22 103016.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

MattAllington
Community Champion
Community Champion

There are various methods. One is to use the banding technique I cover here 

https://exceleratorbi.com.au/banding-in-dax/

 

My demo groups ages into bands. You need to select a tax rate based on a salary - it's the same principle. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

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.