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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Help on retrieving values from other tables based on lookup and if

Hello community,

PowerBI newbie here and I'll appreciate any help I can get.

Here's the data that I'm working with:

Contract   
CUSTOMER_IDCONTRACT_NUMBERPRODUCT_TYPECONTRACT RATE (F)CONTRACT RATE (D)
10002C000148691F17.27 
10004C000148593D 2%
10273C000148681F24.5 
14000C000148727D 3.10%
16000C000148685D 5%

 

Usage     
CONTRACT_NUMBERUSAGE_START_DATEUSAGE_END_DATEUSAGEPRODUCT_TYPEALT_RATEFINAL_RATE
C0001486911/1/20242/1/202478F23?
C0001485931/27/20242/27/202490D23.5 
C0001486811/27/20242/27/202424F26.5 
C0001487271/1/20242/1/202454D17 
C0001486853/22/20244/22/202439D27.8 

 

So essentially there are 2 parts to what I want to do here. I need to do a lookup as well as an 'if' statement which will result in varying outputs.
I need to add a FINAL_RATE calculated column to my Usage table. And the value to be populated in here will be dependent on the product type.


Case 1: Product Type = F
Match by CONTRACT_NUMBER in Contract and Usage tables
Usage'[FINAL_RATE] ='Contract'[CONTRACT RATE (F)]

 

Case 2: Product Type = D
Match by CONTRACT_NUMBER in Contract and Usage tables
Usage'[FINAL_RATE] = (1-'Contract'[CONTRACT RATE(D)]) * 'Usage'[ALT_RATE]

Thank you!!

jannyp_0-1717647786497.png

 

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

 Hi @Anonymous - Create a new column in your usage table as below:

 

FINAL_RATE =
IF(
'Usage'[PRODUCT_TYPE] = "F",
LOOKUPVALUE('Contract'[CONTRACT RATE (F)], 'Contract'[CONTRACT_NUMBER], 'Usage'[CONTRACT_NUMBER]),
IF(
'Usage'[PRODUCT_TYPE] = "D",
(1 - LOOKUPVALUE('Contract'[CONTRACT RATE (D)], 'Contract'[CONTRACT_NUMBER], 'Usage'[CONTRACT_NUMBER])) * 'Usage'[ALT_RATE],
BLANK()
)
)

 

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
rajendraongole1
Super User
Super User

 Hi @Anonymous - Create a new column in your usage table as below:

 

FINAL_RATE =
IF(
'Usage'[PRODUCT_TYPE] = "F",
LOOKUPVALUE('Contract'[CONTRACT RATE (F)], 'Contract'[CONTRACT_NUMBER], 'Usage'[CONTRACT_NUMBER]),
IF(
'Usage'[PRODUCT_TYPE] = "D",
(1 - LOOKUPVALUE('Contract'[CONTRACT RATE (D)], 'Contract'[CONTRACT_NUMBER], 'Usage'[CONTRACT_NUMBER])) * 'Usage'[ALT_RATE],
BLANK()
)
)

 

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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.

Top Kudoed Authors