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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
KF-Hornsby
Frequent Visitor

Divide a value by another value in a related table

Good afternoon, 

I'm trying to divide a sales value by an FX rate held in a different table.  I have a Sales Facts table with a many to one join to an FX Rates table (joined on currency code).  I need to calculate the sales in GBP.  Idealy, this would be as a calculated column as I need to re-use this elsewhere.

 

I've tried

Total Sales CY GBP = divide('Sales Facts'[Sales Value CY], related('FX Rates'[FXRate YTD]))

but I get the error 

KF-Hornsby_0-1619957271103.png

The relationship DOES exist.

 

KF-Hornsby_1-1619957437643.png

 

Any help greatly appreachiated.

 

Dave

1 ACCEPTED SOLUTION
KF-Hornsby
Frequent Visitor

It's a long time since I posted this so I think the answer was something along the lines of one of the tables being import and the other being direct query.  Once the whole model was set to import the issue stopped being a problem.

View solution in original post

7 REPLIES 7
KF-Hornsby
Frequent Visitor

It's a long time since I posted this so I think the answer was something along the lines of one of the tables being import and the other being direct query.  Once the whole model was set to import the issue stopped being a problem.

Rémi-Quentin
New Member

hi everyone,
i'm really interested in this topic as i seem to have the exact same issue with my measure.

i'm wondering if it has something to do with the main table (in the sumx) to be a direct query table ?

as i've tried it with other table that are in import mode and the error "this column either doesn't exist or ..." doesn't show up and it seems to calculate my measure.

i hope we'll soon have something to fix this 🙂

thanks,

Rémi

KF-Hornsby
Frequent Visitor

Is there anything special about this relationship what with it having the " <> " at either end?  Is it just representative of it joining two different data sources (a table imported/dual from a data flow and a direct query to a SQL server).

 

KF-Hornsby_3-1619974597800.png

 

Jihwan_Kim
Super User
Super User

Hi, @KF-Hornsby 

Please try something like below.

 

total sales CY GBP =
SUMX (
'Sales Facts',
'Sales Facts'[Sales Value CY] / RELATED ( 'FX Rates'[FXRate YTD] )
)

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

KF-Hornsby_1-1619973934003.png

 

Anonymous
Not applicable

Just a couple quick thoughts make sure data format are the same in both side.  You can also do a lookup function rather then related.  Lookup doesn't need a relationship between the 2 tables. 

example 

divide([sales] , lookup(fxrates[fxrate],fxrates[currcode],salesfact[currency code] )

KF-Hornsby_2-1619974289524.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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