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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ss89
Helper II
Helper II

Comparison between two columns from different queries

Hello Community,

 

I need to make a comparison between two columns, "Week Planned Out" and "Week Out" that come from two different queries.

When I try to do the IF formula and compare whether the "Week Planned Out" is greater than "Week Out", I cannot select columns from other different queries

How can I do this?

 

ss89_0-1674222057700.png

ss89_1-1674222078268.png

ss89_0-1674222445915.png

 

 

Thanks in advance for your help!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ss89 ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_1-1674458480855.png

Table2

vbinbinyumsft_2-1674458500256.png

Table3:

vbinbinyumsft_3-1674458515563.png

Table4:

vbinbinyumsft_4-1674458537646.png

Model:

vbinbinyumsft_0-1674458458252.png

2. try below dax formula

has relationship:

Column = IF([Sale]>RELATED('Table'[Cost]),"+","-")

vbinbinyumsft_5-1674458721114.png

 

no relationship:

Column =
VAR cost =
    LOOKUPVALUE ( 'Table 3'[Cost], 'Table 3'[Product], 'Table 4'[Product] )
RETURN
    IF ( [Sale] > cost, "+", "-" )

vbinbinyumsft_6-1674458789620.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
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

2 REPLIES 2
Anonymous
Not applicable

Hi @ss89 ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_1-1674458480855.png

Table2

vbinbinyumsft_2-1674458500256.png

Table3:

vbinbinyumsft_3-1674458515563.png

Table4:

vbinbinyumsft_4-1674458537646.png

Model:

vbinbinyumsft_0-1674458458252.png

2. try below dax formula

has relationship:

Column = IF([Sale]>RELATED('Table'[Cost]),"+","-")

vbinbinyumsft_5-1674458721114.png

 

no relationship:

Column =
VAR cost =
    LOOKUPVALUE ( 'Table 3'[Cost], 'Table 3'[Product], 'Table 4'[Product] )
RETURN
    IF ( [Sale] > cost, "+", "-" )

vbinbinyumsft_6-1674458789620.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors