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
Kerrymr2
Frequent Visitor

PowerBi Rolling Sum

Hi All,

I have a project where I need to create a rolling Sum.

I have three tables involved,  VScrapRates, VdateDim, and totalscrap.

Rolling Sum 1.JPG

 

My current DAX calculation is as follows:

Rolling12MonthScrap =
CALCULATE(
Sum(TotalScrap[InitalDollars]),
DATESINPERIOD( VDateDim[Date], LASTDATE( VDateDim[Date] ), -12, MONTH ) )
 
The date dim table is a date table and is tied to a timeline slicer.  When the user selects a month on the slicer we want to sum the rolling 12 months of initial dollars from the total scrap table from the selected month backwards.
 
However, this is what I'm getting.  The second row is correct and I have no idea where the first row comes from.  Ideas?
rESULT.JPG
 
Thanks in advance,
K.
 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Kerrymr2 , is one of the other your columns un summarized?

Also, make sure yearmonth is coming from VDateDim and it is marked as date table

View solution in original post

3 REPLIES 3
Kerrymr2
Frequent Visitor

VDateDim is marked as a date table.  

If I remove every column except Corporate scrap percentage from VscrapRates in the table it still happens.

If I remove every visual filter, still happens.

If I change the slicer attached to VdateDim, the value remains constant.

It may be that CorporateScrapPercentage is not summarized.  Suggestions on what to try?

Capture2.JPG

 

 

 

 

Thanks, it steered me in the correct direction.  It was an issue where there was no relationship between VscrapRates[plant] and TotalScrap[Plant].

Cleaned up relationships, modified and added some measures and everything is working.

Thanks for steering me in the right direction.

 

K.

amitchandak
Super User
Super User

@Kerrymr2 , is one of the other your columns un summarized?

Also, make sure yearmonth is coming from VDateDim and it is marked as date table

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors