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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Rolling 3 months calculation

Hi I am looking at creating a DAX measure which looks at the waste weight value column (Table Data) to see if there is any data and if not calculates a rolling 3 month to give me information as to whether the site has submitted or not submitted thier data. The Table data shows the initial table view and the intended results table shows the Rolling 3 months results i am looking for. Thnaks in advance for your help. 

 

 

Table DataTable DataIntended Results TableIntended Results Table

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , with help from a date tbale try measure like

 

Rolling -3 =
Var _1 = CALCULATE(sum(Table[ waste weight value]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date])-1,-3,MONTH))
return
if(isblank(_1) || _1 =0 , "Not Submitted", "Submitted")

 

or


Rolling -3 =
var _max = MAX('Date'[Date])-1
var _min = Date(year(_max), month(_max)-3, day(_max))
Var _1 = CALCULATE(sum(Table[ waste weight value]),filter(all('Date') , 'Date'[Date] >=Min && 'Date'[Date] <=_max))
return
if(isblank(_1) || _1 =0 , "Not Submitted", "Submitted")

 

 

use date from date table in visual

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

v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

You could try it.

Measure = 
var _dif=DATEDIFF( MINX(ALL('Table'),[Month]),MAX([Month]),MONTH)
var _cout=CALCULATE(COUNT([Waste Weight value]),
            FILTER(ALLEXCEPT('Table','Table'[Site ID]),FORMAT( MAX('Table'[Waste Weight value]),"string")<>BLANK()&&
                        [Month]<=MAX([Month])&&EOMONTH([Month],0)>EOMONTH(MAX([Month]),-3)))
var _b= IF(_dif>=2, IF(_cout>=3,"Submitted","Not Submitted"))
return _b

The final output is shown below:

vyalanwumsft_0-1641176036863.png

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.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

How would i go about creating a count to count how many of the sites have submitted that month in order to create trend graphs to see in which months how many sites submitted data and how many didnt? 

v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

You could try it.

Measure = 
var _dif=DATEDIFF( MINX(ALL('Table'),[Month]),MAX([Month]),MONTH)
var _cout=CALCULATE(COUNT([Waste Weight value]),
            FILTER(ALLEXCEPT('Table','Table'[Site ID]),FORMAT( MAX('Table'[Waste Weight value]),"string")<>BLANK()&&
                        [Month]<=MAX([Month])&&EOMONTH([Month],0)>EOMONTH(MAX([Month]),-3)))
var _b= IF(_dif>=2, IF(_cout>=3,"Submitted","Not Submitted"))
return _b

The final output is shown below:

vyalanwumsft_0-1641176036863.png

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.

amitchandak
Super User
Super User

@Anonymous , with help from a date tbale try measure like

 

Rolling -3 =
Var _1 = CALCULATE(sum(Table[ waste weight value]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date])-1,-3,MONTH))
return
if(isblank(_1) || _1 =0 , "Not Submitted", "Submitted")

 

or


Rolling -3 =
var _max = MAX('Date'[Date])-1
var _min = Date(year(_max), month(_max)-3, day(_max))
Var _1 = CALCULATE(sum(Table[ waste weight value]),filter(all('Date') , 'Date'[Date] >=Min && 'Date'[Date] <=_max))
return
if(isblank(_1) || _1 =0 , "Not Submitted", "Submitted")

 

 

use date from date table in visual

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
Anonymous
Not applicable

How would i go about creating a count to count how many of the sites have submitted that month in order to create trend graphs to see in which months how many sites submitted data and how many didnt? 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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