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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Amrselim1989
Helper II
Helper II

Optimizing sumx

hello,

kinldy i have very simple sumx calculation 

 

it iterates agients 3 million row in a table and about 300 rows in another table;

the code is 

 

Sum of Net Sales Value in USD = sumx('Table', 'Table'[Net Sales Value] / RELATED(RateDate[USD Price]))
 
the table i have is like this but with 3 millions rows and has dublicate in Date column
Date Net Sales Value
1/1/2019 10
1/1/2019 20
1/1/2019 45
1/2/2019 67
1/2/2019 87
1/3/2019 45
1/4/2019 44
 
the RateDate USD is my currency to USD rate:
 
1/1/2019 4
1/2/2019 5
1/3/2019 5
1/3/2019 5
 
my code in visual gives me visual has excedded avaiabale resources, i know it's be cause the itration, can i optimize this code at least to summerize sales of a single date they divide it on USD rate, but it must be itrated on date by date to perserving the USD rate day by day?!!
1 ACCEPTED SOLUTION
mickey64
Super User
Super User

For your reference.

I use ’SUM’ instead of 'SUMX'.

 

Step 1: I make a calendar table and add 2 relationships.

mickey64_0-1695339255346.png

Step 2: I make a measure below.

    Measure = DIVIDE(SUM('Table'[Net Sales Value]),AVERAGE('RateDate'[USD Price]))

 

Step 3: I make a matrix below.

mickey64_1-1695339385002.png

 

 

View solution in original post

1 REPLY 1
mickey64
Super User
Super User

For your reference.

I use ’SUM’ instead of 'SUMX'.

 

Step 1: I make a calendar table and add 2 relationships.

mickey64_0-1695339255346.png

Step 2: I make a measure below.

    Measure = DIVIDE(SUM('Table'[Net Sales Value]),AVERAGE('RateDate'[USD Price]))

 

Step 3: I make a matrix below.

mickey64_1-1695339385002.png

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.