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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
siamoaquile
New Member

Calculated column or measure that returns values from Table A corresponding to certain values Tab B

Hi,
i'd want a Calculated measure or column that returns values of column x of table A corresponding to certain values of another 'table B (for example). What dax should i write?

This is because I tried to write this function:

CampagnaZefir= IF(SELECTEDVALUE(TableB[CodZef]) IN {"2025","C25","F25","W25"},1,0)

and i put it as a filter
siamoaquile_0-1739275126816.png


but the table shows filtered results only if I add the TableB[CodZef] column, otherwise the values of Table A do not appear. But I want the filtered values to tick without me putting the CodZef column. 

How can i do that? Thank you!!




5 REPLIES 5
siamoaquile
New Member

i tried related, relatedtable and lookup but if i put IN {"2025", "C25", "F25", "W25"}, there is an alert that says me that "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value"

Anonymous
Not applicable

Hi @siamoaquile 

 

Thank you very much bhanu_gautam for your prompt reply.

 

Allow me to add something:


Use the RELATED function to ensure there is a relationship between Table A and Table B. For example:

 

"TableA"

vnuocmsft_0-1739346979853.png

 

"TableB"

vnuocmsft_1-1739347003251.png

 

vnuocmsft_2-1739347074129.png

 

If you don't have a column in your data that would allow you to establish a relationship, you might consider creating a calculated column and using the LOOKUPVALUE function:

 

FilteredColumn = 
IF (
    LOOKUPVALUE(TableB[CodZef], TableB[ID], TableA[ID]) IN {"2025", "C25", "F25", "W25"},
    1,
    0
)

 

vnuocmsft_3-1739347278953.png

 

Regards,

Nono Chen

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

 

 

 

 

 

 

bhanu_gautam
Super User
Super User

@siamoaquile , You can try using a calculated column

CampagnaZefir =
IF (
RELATED(TableB[CodZef]) IN {"2025", "C25", "F25", "W25"},
1,
0
)

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






i can't find the column in RELATED()

Hi,

 

Some liitle things to check :

1/ Do you have a relationship between the 2 tables in your model ?

2/ If no, you need to build the relationship in the model view before using related.
If yes, are you using the relationship from the table on the side 1 to the table on the side many, or from the table many to the table on the one side of relationship ?

RELATED can be used from the many (*) to one (1), and if you are on the table being on the 1 side and want to get info from the table on the many side, then you'll need RELATEDTABLE as your results will/might not be unique.

In case it might not be clear, herre is an image 😉

Fonction_RELATED.pngFonction_RELATEDTABLE.png

Hope it help

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.