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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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!

 

v-rongtiep-msft
Community Support
Community Support

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.