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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.