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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Puttsson
Helper I
Helper I

Accumulate data over a period on a measures not working

Hey,

 

I'm trying to sum up the R12 value for a column that I created. But it doesn't work.

 

RM R12 is supposed to show R12-value of RMprevmonth

Puttsson_0-1665146553981.png

 

It seems somewhat random what's shown. Am I missing something in the measures?

vFactRM har a relationship to DimDates on [RevenueDate] to DimDate[Date]

This measures shows the actual month or the previous month for future months

 

RMprevmonth =
VAR _lastSalesDate = CALCULATE(MAX(vFactRM[RevenueDate]),ALL(vFactRM))
VAR _lastSalesMonth = CALCULATE(MAX(DimDate[Date]),ALL(DimDate),DimDate[Date]=_lastSalesDate)
VAR _lastMonthTotal = CALCULATE(SUM(vFactRM[AmountInSEK]),ALL(DimDate),DimDate[Date]=_lastSalesMonth)
VAR _thisMonth = MAX(DimDate[Date])
VAR _prevMonthSales = CALCULATE(SUM(vFactRM[AmountInSEK]),PREVIOUSMONTH(DimDate[Date]))
RETURN
IF(_thisMonth<=_lastSalesMonth,_prevMonthSales,_lastMonthTotal)  //SUM(vFactRM[AmountInSEK])

 

RM R12 =
CALCULATE (
[RMprevmonth],
DATESINPERIOD ( DimDate[Date], MAX ( DimDate[Date] ), -12, MONTH )
)

 

Thanks!

2 REPLIES 2
Puttsson
Helper I
Helper I

Hi,

Thanks for the reply

What I want to achieve is a rolling 12 months value in "RM R12". So for each month it should be the sum of the last 12 months of RMprevmonth.

 

The relationship:

vFactRM has a relationship to DimDate on [RevenueDate] to DimDate[Date]

 

Puttsson_0-1665386258931.png

 

Sorry I can't attach a pbix-file. 

 

Thanks!

 

Anonymous
Not applicable

Hi @Puttsson ,

There are seems two tables inside. What is the relationship between the 2 tables ? What are the data in the DimDate Table  like? How about in the vFactRM Table?

 

Could you please provide more details with your desired output and pbix file without privacy information?

 

How to Get Your Question Answered Quickly 

 

Best Regards

Community Support Team _ Polly

 

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.