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 August 31st. Request your voucher.

Reply
Anonymous
Not applicable

lookup values from another table

Hi, experts, I have two tables, dimension table and fact table, I created a filter use column from dimension table, but fact table may not exist some values in dimension table, and I need to make sure all the values from the fiters selected has relevant data, do you have any ideas?

My idea is that creat a measure in the dimension table, when the value from fact table exist in dimension table, then return 1, else 0, and apply this measure to the filter, but the measure crteated is not work.

here is the sample data and expected result:

dimsention table

region

A

B
C

fact table

regiondata
Aadaf
Cfadfa

expected result:

regionmeasure
A1
B0
C1

I created mesure like this: 

measure=

VAR _fact=MAX('fact'[region])

VAR _dim=MAX('dim'[region])
RETURN IF(_fact=_dim,1,0)
but the measure did not work
do you know how to how to make this measure correct or any other ideas on make the slicer show only relevant data?
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

(1) We can create a calculated column.

Column = IF('Fact Table'[region]=RELATED('Dimension table'[region]),1,0)

(2)We can create a measure. 

Measure = IF(SELECTEDVALUE('Fact Table'[Column])==BLANK(),0,1)

(3) Then the result is as follows.

vtangjiemsft_0-1672017918373.pngvtangjiemsft_1-1672017936422.png

Best Regards,

Neeko Tang

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

7 REPLIES 7
Anonymous
Not applicable

Hi @Anonymous ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a measure. 

Measure = IF(LOOKUPVALUE('dimsention table'[region],'fact table'[region],MAX('dimsention table'[region])) ==BLANK(),0,1)

(3) Then the result is as follows.

vtangjiemsft_0-1671775690111.png

 

Best Regards,

Neeko Tang

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

Anonymous
Not applicable

Thanks, the sample data maybe too simple and some problems might hidden.

If I add a row of data in fact table {C, aaa}, and the required relationship is 1-n, there would be an error, and I tried many times with this method

here is the fact table and relationship, and relevant error:

fact table added one record:

null_0-1671787658105.png

relationship:

null_1-1671787699100.png

error:

null_2-1671787756036.png

 

Anonymous
Not applicable

Hi @Anonymous ,

 

(1) We can create a calculated column.

Column = IF('Fact Table'[region]=RELATED('Dimension table'[region]),1,0)

(2)We can create a measure. 

Measure = IF(SELECTEDVALUE('Fact Table'[Column])==BLANK(),0,1)

(3) Then the result is as follows.

vtangjiemsft_0-1672017918373.pngvtangjiemsft_1-1672017936422.png

Best Regards,

Neeko Tang

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

Anonymous
Not applicable

Thanks for your explanation, did you get an error when creating column? Actually there is always an error when I create a column like that, it says parameter is not the correct type

null_1-1672107060118.png

 

 

Anonymous
Not applicable

Hi @Anonymous ,

 

You should create calculated columns and measures on the fact table, as shown in my picture.

Picture1.png

 

Best Regards,

Neeko Tang

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

Anonymous
Not applicable

Hi @Anonymous ,

Please find the below solution.

Column = IF(Dim[Region]=RELATED('Fact'[REgion]),1,0)
shreyamukkawar_0-1671705586503.png

 

Best Regards,
Shreya

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

Anonymous
Not applicable

I did not get the result use this column, there is  aloway an error with RELATED function,
maybe because the data is imported?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.