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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Calculate sum of qty in different timeperiods in relation to my slicer

Hi

I need to create a measure that calculates my qty in different time periods. 

 

The periods should relate to which yearmonth i chose in my slicer. 

 

The periods are as follows: 0-6 month, 6-12 months, 12-24 months and >24 months

 

Anybody who can help me with the DAX to create this/these measures? 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Create these values in an independent table and handle and switch .

 

Measure you need are

 

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

 

Rolling 6 to 12  = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date ]),-6),-6,MONTH))

 

 

Rolling 12 to 24  = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date ]),-12),-12 ,MONTH))

 

 

create slicer as we do in measure slicer

refer

https://community.powerbi.com/t5/Desktop/Required-custom-date-Slicer-Last-7-days-last-15-days-last-30/m-p/1284966#M561629

 

How to create a Measure Slicer: https://youtu.be/b9352Vxuj-M

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Create these values in an independent table and handle and switch .

 

Measure you need are

 

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

 

Rolling 6 to 12  = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date ]),-6),-6,MONTH))

 

 

Rolling 12 to 24  = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date ]),-12),-12 ,MONTH))

 

 

create slicer as we do in measure slicer

refer

https://community.powerbi.com/t5/Desktop/Required-custom-date-Slicer-Last-7-days-last-15-days-last-30/m-p/1284966#M561629

 

How to create a Measure Slicer: https://youtu.be/b9352Vxuj-M

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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