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
Anonymous
Not applicable

Help with Measure Performance

Hi

I have a very simple measure to calculate amount using forex rate but it is running slow once I include fields from entities like Contract and Org. The measure is used in a martix. When used in table at invoice level from fact without any filters it still runs fine but with inclusion of additional fields from Contract and Org slows it down. 

The measure formula is as follows

Outstanding_Amount_FXInc =
var _selectedPeriod = MAX('FactInvoices'[Reporting_Date])
VAR _financialPeriod = FORMAT(_selectedPeriod,"MMM") & " " & FORMAT(_selectedPeriod,"YYYY")

var fxRate = CALCULATE(MAX(FxRate[Value]),FxRate[MonthYear] = _financialPeriod)

RETURN SUM('FactInvoices[Outstanding_Amount]) * IF(MAX('Company'[Company_Code]) = "x",1/fxRate,1)
Model is as below with counts mentioned. Any idea how to fix the measure to perform better?
GKrishnan_0-1688188557580.png

 




1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 
It is would be a good idea to have a date table that filters both Fact and FxRate tables. That would definitely improve the performance. Also note that you DAX would probably generate wrong total.

View solution in original post

4 REPLIES 4
ppm1
Solution Sage
Solution Sage

You should add a Date table to your model (that has a financial period column in it) and relate that to your Reporting Date column in the fact table. You could also likely merge your rate table into your Date table, so you could then do a simple RELATED from the fact table to get the rate for that date.

 

What are the relationships between your tables? I suspect you have a bi-directional relationship in the mix (to the Company table?). Your model should have only 1:M relationships if at all possible. Can you grab the Company code with a RELATED too, to avoid the IF?

 

Pat

Microsoft Employee
Anonymous
Not applicable

Thanks. I updated the model with relationship between Date and FxRate/ Date & Fact and using related function. It works better now.

tamerj1
Super User
Super User

Hi @Anonymous 
It is would be a good idea to have a date table that filters both Fact and FxRate tables. That would definitely improve the performance. Also note that you DAX would probably generate wrong total.

Anonymous
Not applicable

Thanks. I updated the model with relationship changes as per suggestion and using related function. It works better now.

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.