DAX Performance Issue

TheStressMachine

New Member
Joined
May 19, 2016
Messages
9
Hi,

I've taken the logic from this post (and other similar ones):
excel formula - DAX / PowerPivot query functions to spread aggregated values over time period - Stack Overflow

To create a pivot table with an even spread of revenue over time.

In my data table (CombinedOutput), I have 3 key fields:
StartDate
EndDate
RevenuePerDay (I created this in the source data trying to solve my performance problem, the post above does this calculation in DAX).

I also have a typical calendar table, unconnected per the post.

I'm trying to spread revenue per day across any slice of time (months, quarters, years, etc) and have two measures:

Measure1:
CALCULATE(SUM(CombinedOutput[RevPerDay]),
FILTER (
CombinedOutput,
CombinedOutput[StartDate] <= MAX ( Calendar[Date] )
&&CombinedOutput[EndDate] >= MAX (Calendar[Date] )
)
)

Measure2:
SUMX (
VALUES ( Calendar[Date] ),
SUMX ( VALUES (CombinedOutput ), [Measure1] )
)


This works, but I'm running into performance problems. The entire dataset takes about a minute to calculate and playing with various slicers to filter the data takes about 10 seconds a pop. My data table has about 7,000 rows and my calendar table has about 450. Adding Measure1 to the pivot doesn't cause a performance problem (but is obviously the wrong data), adding measure2 when measure1 doesn't filter against the calendar table isn't a performance problem either (but the spread goes on forever and ignores start/end). It seems that the double pass over the calendar table is causing the issues and I'm not a real data guy, just an example junkie, so I'm not sure if there is a more efficient way to achieve the same goal.

I would have to scramble the dataset before sharing so let me know if that's needed.

Any ideas on how to do this more efficiently? I would be a sad dude if I can't make this happen with a relatively small data set.
 
Interesting.
My Excel 2016 64-bit version 16.0.7571.7095 works fine.

I also tried loading the same tables into an Excel 2010 PowerPivot model with the same PivotTable, and it seems to work fine as well.

I would be interested in whether rebuilding from scratch fixes the issue or whether anyone else can reproduce the issue.
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top