Forum Discussion
Report is too slow
What exactly is slow? Is it slow to load in the service, is it slow to refresh the queries, is it slow to add new measures? How many measures are in the data model? Do you have any table or matrix visuals that contain a lot of different measures? Do any of your measures use iterator functions like SUMX, AVERAGEX, etc?
Hi,
Sorry for the unclarity. The report is currently slow in the desktop app. The refreshing is quite slow, but acceptable. The slowest part is the loading and filtering of the report through slicers. I have 4 tables that consist of the following type of measure.:
Weighted question 2 = SUMMARIZE('Performance Snapshot';'Performance Snapshot'[Team Member];"Weight question two value";SUMX(FILTER(ALL('Performance Snapshot');'Performance Snapshot'[Team Member]=EARLIER([Team Member]));
[Number of hours]/SUMX(FILTER(ALL('Performance Snapshot');'Performance Snapshot'[Team Member]=EARLIER([Team Member]));[Number of hours])*[Always on my team]))
These tables are used in half the visualizations, but are mostly not matrixes or tables.
I also have a measure taking date columns from different lists and combining them into one single date query as follows:
Formula: Date Slicer = DISTINCT( UNION(VALUES('Check-In'[End Date]);VALUES('Pulse Survey'[Modified]);VALUES('Performance Snapshot'[Modified]);VALUES('Career Aspirations'[Year]);VALUES('My Strengths'[Year]);VALUES('Firm Contributions'[Year]);VALUES('Goal Setting'[Year])))
Thanks for your help
- Anonymous9 years agoNot applicable
Oh yeah, nesting multiple SUMXs inside a SUMMARIZE will definitely slow things way down, especially if there are a lot of rows in whatever you're SUMXing. As a first step, I would recommend installing DAX Studio and learning how to use that. You can run test queries to find out how quickly or slowly a particular measure will run, which will help you find the major sources of slowdown. Then you can focus on those measures and see if there is a more efficient way to write them. I'll play around with your example measures to see if I can come up with any better methods.
- Anonymous9 years agoNot applicable
God help us you have a SUMX with an ALL filter nested inside another SUMX with an ALL filter. I'm not trying to be mean but that's the DAX equivalent of replacing your car's oil with 5-minute epoxy. On every row of your table, your formula evaluates a formula on every row of the table. Inside that formula, on every row of the table, it evaluates another formula on every row of the table. It then uses these results to generate a summary table that includes every row of the table. You see the problem right?
It gets even worse when you put this into a visual. If you're putting this measure next to a column from the table, it must do all those steps a separate time for each member of that column in the visual.
It would help to see some sample data so I can get an idea of what kind of tables this is operating on. You can make something fake at mockaroo.com if your real data cannot be shared. How many rows are in this performance snapshot table? Also you're referencing several other measures inside this measure, so it would also be helpful to see the formulas for those measures.
Right off the bat I can tell you that the general pattern you're using is not as efficient as it could be, aside from the nested SUMX issue. Written generically, your measure follows this pattern:
SUMMARIZE( TableName, TableName[Column1], TableName[Column2], "MeasureName", SUMX( FILTER( TableName, TableName[Column3] = "examplevalue" ), CALCULATE(SUM(TableName[Column4])) ) )
That is almost always less efficient than this pattern:
ADDCOLUMNS( SUMMARIZE( TableName, TableName[Column1], TableName[Column2] ), "MeasureName", SUMX( FILTER( TableName, TableName[Column3] = "examplevalue" ), CALCULATE(SUM(TableName[Column4])) ) )
In your case the speed gain will be pretty minor right now, because the rest of the formula is slowing everything down so much. Still, the final form of this measure should still be switched to this pattern because hopefully we'll find a way to rewrite those nested SUMXs so they're not such a problem. I'll get back to you on the rest of it once I have a little more info from you about how it all works.
- Matthias939 years agoHelper III
Hi thank you for your fast answer. I did not know my DAX measures were the root of all evil. It was suggested to me on this very forum when I asked on some help on making it. Being a novice I did not think to think about the performance of it all.
So what I have is a table with one line for each performance snapshot. Each line contains information of the employee it's connected to as well as values for 4 different questions (question 1 and 2 have values between 1 and 5 and questions 3 and 4 are binary. A final column it contains is the number of hours related to the performance snapshot. Each question has a different 'weighted score' table where it has a column with the name of the employee and the weighted score for a question. This wieghted score is calculated the same way for each question. See the pictures below for more information. The first one shows what I want to achieve with the weighted questions. The second one shows how it's being done at the moment.
Thanks a lot already for your help, really appreaciate it
- Matthias939 years agoHelper III
Thanks, I will have a look at this tool and try to make it more efficient as well.