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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
rgirotra
Frequent Visitor

Calculated Measure performance enhancement

I have created a measure to calculate the Last 45-day cumulative SalesValue for particular SKU of selected Date.
this measure is taking more time than expected to load the data.

is there any better way to write this query?

this is my measure query

Rtn Sales Value (45) =
CALCULATE (
SUM(ReturnTable[Sales Value]),
FILTER (
ALL ( ReturnTable ),
ReturnTable[Created Date] > MAX ( ReturnTable[Created Date] ) - 45
&& ReturnTable[Created Date] <= MAX ( ReturnTable[Created Date] ) && ReturnTable[SKU] = MAX(ReturnTable[SKU])
)
)

1 ACCEPTED SOLUTION
CahabaData
Memorable Member
Memorable Member

Alternate dax statement does same thing:

CALCULATE( [Total Sales],

 DATESINPERIOD( Dates[Date], MAX( Dates[Date] ), -30, Day ) )

 

am using generic table/field names, not yours, 30 day example of course - and Dates table is just that ....assume you have one...

 

I've never seen a statement that this would be faster so am interested if it is, hope you'll post....

 

www.CahabaData.com

View solution in original post

1 REPLY 1
CahabaData
Memorable Member
Memorable Member

Alternate dax statement does same thing:

CALCULATE( [Total Sales],

 DATESINPERIOD( Dates[Date], MAX( Dates[Date] ), -30, Day ) )

 

am using generic table/field names, not yours, 30 day example of course - and Dates table is just that ....assume you have one...

 

I've never seen a statement that this would be faster so am interested if it is, hope you'll post....

 

www.CahabaData.com

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.

Top Solution Authors
Top Kudoed Authors