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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Chaucer
Helper II
Helper II

HIstoric Rolling MEasure

I have a Measure that calculates the Customer Lifetime Revenue [CLR]. When graphed on a line graph with a date axis, it displays the CLR filtered for just that day. I wanted to create a measure that displayed how the CLR changes over time. Obviously a single day isn't that worthwhile as all it's doing is showing the revenue per customer that day. 

 

So, I created a new Measure:

CLR2YR = Calculate(
[CLR],datesbetween(Dates[Date],SELECTEDVALUE(Dates[Date]) - 730,SELECTEDVALUE(Dates[Date])
))
 
This does the job, but it is EXTREMELY slow. Any suggestions on how to make it more performant?
 
Thanks
1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

I would recommend you install and use DAX Studio to evaluate the query plan, and to check if alternative implementations have better performance.  Avoid nesting measures , use variables, try SUMX etc.

 

If you like more help please provide sanitized sample data that fully covers your issue.


View solution in original post

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @Chaucer ;

Is your problem solved? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yalanwu-msft
Community Support
Community Support

Hi, @Chaucer ;

May be you could try it.

measure=CALCULATE([CLR],DATESINPERIOD('Table'[Date],SELECTEDVALUE('Table'[Date]),-730,DAY))

Or 

Measure = 
var _se=SELECTEDVALUE('Table'[Date])
return CALCULATE([CLR]),datesbetween('Table'[Date],_se-730,_se))


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

I would recommend you install and use DAX Studio to evaluate the query plan, and to check if alternative implementations have better performance.  Avoid nesting measures , use variables, try SUMX etc.

 

If you like more help please provide sanitized sample data that fully covers your issue.


Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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