cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mikkelbn
New Member

Create column value from non related table

I am new to power BI and cannot get this to work:

I have a table: Customer ID | Customer | Value | Level - the first three are populated and the last needs to be populated lookup in another table: Level | From | To - meaning the if the  Value from first table is between From and To in the second table the Level should be set. Is that doable?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

You can filter your second table for each row on the first table, if the result of filtering is a single row, you can use any expressions with "first" or "last" to get this row.

 

Try this formula on CustomerTable[Level]:

 

 

Customer Level = CALCULATE( LASTNONBLANK('LevelTable'[Level];1) 
		; FILTER( 'LevelTable';'LevelTable'[From]= CALCULATE(
LASTNONBLANK('LevelTable'[From];1)
;FILTER('LevelTable';'LevelTable'[From]<= 'CustomerTable'[Value]
&& 'LevelTable'[To]>='CustomerTable'[Value]))))

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

You can filter your second table for each row on the first table, if the result of filtering is a single row, you can use any expressions with "first" or "last" to get this row.

 

Try this formula on CustomerTable[Level]:

 

 

Customer Level = CALCULATE( LASTNONBLANK('LevelTable'[Level];1) 
		; FILTER( 'LevelTable';'LevelTable'[From]= CALCULATE(
LASTNONBLANK('LevelTable'[From];1)
;FILTER('LevelTable';'LevelTable'[From]<= 'CustomerTable'[Value]
&& 'LevelTable'[To]>='CustomerTable'[Value]))))

 

View solution in original post

Worked perfect, thank you 🙂

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors