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

Cummulative sum of previous period not working properly

Hi,

I have a problem while constructing a cummulative sum chart for a comparison with a target&previous period numbers.

 

I have defined revenue as:

 

 

 

Total Revenue DK = Calculate(sum(Orders[SubTotal]), some irrelevant filters here)

 

 

 

then the previous year's revenue:

 

 

 

Prev Year Revenue DK = CALCULATE([Total Revenue DK], SAMEPERIODLASTYEAR('Calendar'[Date]))

 

 

 

and then I proceeded to create the running total of previous year's revenue:

 

 

 

Prev Year Revenue DK RT = 
CALCULATE(
	[Prev Year Revenue DK],
	FILTER(
		ALLSELECTED('Calendar'[Date]),
		'Calendar'[Date] <= MAX('Calendar'[Date])
	)
)

 

 

 

 

Here's the issue with that:

mba_0-1637228495969.png

the today's number (18/11/2021 in this case) for a corresponding last year's running total is literally the total sum of the whole current month - hence the sudden rise.

The chart filtering is set for the current month.

What should I do in this case?

4 REPLIES 4
v-janeyg-msft
Community Support
Community Support

Hi, @mba 

 

Not sure if it’s a problem with time intelligence functions.

You can try:

 

Prev Year Revenue DK = CALCULATE([Total Revenue DK], DATEADD('Calendar'[Date], -1, year))

 

 Not clear about your visual context.

You can try:

 

Prev Year Revenue DK RT = 
CALCULATE(
	[Prev Year Revenue DK],
	FILTER(
		ALL('Calendar'[Date]),
		'Calendar'[Date] <= MAX('Calendar'[Date])
	)
)

 

You can also try to merge there measures to one measure.

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

 

Best Regards,
Community Support Team _ Janey

amitchandak
Super User
Super User

@mba , Assume you have cumm measure

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=max(date[Date])))

 

year behind cumm

Cumm Sales Tr 1 = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=maxx(date,dateadd(date[date]),-1,year)))

According to your advice, I changed it to:

 

 

Prev Year Revenue DK - RT = 
CALCULATE(
	[Total Revenue DK],
	FILTER(
		ALLSELECTED('Calendar'[Date]),
		'Calendar'[Date] <= MAXX('Calendar', DATEADD('Calendar'[Date], -1, YEAR))
)
)

 

 

 

... but now the values are completely missing:

mba_0-1637239191505.png

It is due to the fact that dateadd() put it back one year, so there's no way that it is higher than current date. Hence no values.


PS. It's all on the same graph as these from current year.

 

@mba  Any updates?

 

I haven't received your reply and don't know your current situation.

If you still need help, please feel free to ask me.


Best Regards,
Community Support Team _ Janey

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.