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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply

SUM every 8 days value from today to last 6 months

  • Hi guys,

 

I wonder if it is possible to SUM every 8 days value from today to the last 6 months? Using Dax

 

* the type of the value is discrete so I need to take just one value for every 8 days, not the sum of the 8 days. 

* i can use filter to specify the last 6 months. Not necessary to do that in DAX 

Thanx !! 

 

🤝💜

 

 

@RicoZhou

 

please help. 

 

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @ALEX2011ALfer_ 

>> to SUM every 8 days value from today to the last 6 months

You can try this, create the measures below

Measure1 = 
var _n=8
var _diff=DATEDIFF(MIN('table'[Date]),TODAY(),DAY)
return mod(_diff,_n)
Measure2 = CALCULATE(SUM('table'[Index]),FILTER(ALL('table'),'table'[Date]<TODAY() && 'table'[Date]>= EDATE(TODAY(),-6) && [Measure1]=0))

vxiaotang_1-1654674506790.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @ALEX2011ALfer_ 

>> to SUM every 8 days value from today to the last 6 months

You can try this, create the measures below

Measure1 = 
var _n=8
var _diff=DATEDIFF(MIN('table'[Date]),TODAY(),DAY)
return mod(_diff,_n)
Measure2 = CALCULATE(SUM('table'[Index]),FILTER(ALL('table'),'table'[Date]<TODAY() && 'table'[Date]>= EDATE(TODAY(),-6) && [Measure1]=0))

vxiaotang_1-1654674506790.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@ALEX2011ALfer_ , You have to create that column in Table

 

quotient( -1* Datediff(today(), [Date], day),8)+1

 

This will create a partition you can use in group by/row/axis etc .

 

you can use a measure like

 

 

Rolling 6 Sales =
var _max = today()
var _min = date(year(_max), month(_max)-6,1)
return
CALCULATE(SUM(Sales[Sales Amount]),filter(date, date[date] <=_max && date[date] >=_min))

 

 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.