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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
BIanon
Resolver I
Resolver I

Measure performance issue

Hello community,

Here is some sample data:

 

idtripidValueValue2
112,15
212,17
312,13
123,72
223,76
323,78
131,14
231,12
331,15
431,18
140,79
240,74
340,732
150,94
250,965

 

I am trying to sum all of the values in the [Value] column but only once for every TripId. My current measure looks like this:

 

SUMX(VALUES('Table'[TripId]), CALCULATE(MAX('Table'[Value])))

 


I have been getting some performance issues with this measure unfortuately. I've tried doing some basic tests where I just put Year, Month and the measure in a visual

PeriodMSRows in table in selection
Single year6505347756
Two years148712138754
Three yearsVisual has exceeded the available ressources19318853



I get how iterating over the table is bad for performance vs a simple sum, but I have so few rows to work with (~33 m rows total) so it just feels like I must be missing something obvious since I am getting such bad performance from a simple measure.

Are there any tricks that I can use or a different DAX pattern perhaps? My only idea is adding aggregation tables, but it just seems excessive for something so basic and with so small data volumes

Note that my calendar dimension is filtering this fact table through a date key and has a one-to-many relationship.

If I do a simple EVALUATE on just the measure, grouped by nothing, the measure runs in 1 MS for all of my data in DAX Studios.

The following query in DAX Studios runs in 2900 MS:

 

EVALUATE

CALCULATETABLE(
	ADDCOLUMNS(
		VALUES( 'Calendar'[Year] ),
		"Value", [Measure]
		)
		)

 

 
2900 MS is obviously a very slow measure, but I am surprised that it cannot run at all, not even locally in desktop.

2 REPLIES 2
v-kaiyue-msft
Community Support
Community Support

Hi @BIanon ,

Based on the information you've provided, the performance bottleneck seems to be related to the way the metrics are calculated, try changing sumx to something like calculate(sum(), filter()) to see if that improves the speed. Here's a related document that will hopefully help you: DAX Performance issue: why is my SUMX() so slow? - Stack Overflow.

In addition, performance is also related to filters, filters, and data models, which can be found in the documentation:Optimization guide for Power BI - Power BI | Microsoft Learn.

 

Also, although you mentioned that adding an aggregate table seems a bit much, for measurements that aggregate large amounts of data, adding an aggregate table can dramatically improve performance, and it's not a bad way to go .

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@BIanon , The measures seems fine, but try this

 

SUMX(Summarize('Table','Table'[TripId], "_1",MAX('Table'[Value])), [_1])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.