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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Creating a rolling 7 day net total

Hi all,

 

I have created a measure to work out the (Difference) between sales from one to the next; see below.

 

gh614_1-1653038975185.png

I am trying to create a measure which will create a net position by summing the (Difference) figures in the last 7 days. The total should be -155,516.48.

 

I hope that makes sense.


Thanks in advance.

 

 

 

2 REPLIES 2
Anonymous
Not applicable

Hi,

 

Thanks for the quick reply.

 

Sorry, I'm struggling to understand how to edit the first measure. Also, the second measure isn't picking up the (Difference) measure to sum.

 

I'm trying to sum this (Difference) number to create a net movement for the 7 days.

gh614_0-1653052077549.png

 


Would appreciate your feedback.


Thanks,


Glen

amitchandak
Super User
Super User

@Anonymous , Try like

 

Rolling 7 Sales =
var _max = maxx(allselcted(date),date[date]) // or today()
var _min = _max -7
return
CALCULATE(SUM(Sales[Sales Amount]),filter(date, date[date] <=_max && date[date] >=_min))

 

 

or

 

Rolling 7 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-7,DAY))

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.