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

Cumulative values from Specific Date

Hello , 

 

Let's say I have a Forecast table with the following data

 

 

DateSales
05/202210
06/202220
07/202230
08/202240
09/202250
10/202260

 

I need to create a table graph that will always start cumulating the values from M-1 (based on today's date) and put whatever is  before it as 0 like below  : 

 

DateCumulated Values
05/20220
06/20220
07/20220
08/202240
09/202290
10/2022150

 

How can I achieve this ?

 

Thanks in advance,

 

Best Regards,

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @adk79 ,

 

Here I create a sample to have a test and I think you can try below code to create a measure.

Sample:

RicoZhou_1-1664180328719.png

Measure:

Measure = 
VAR _START = EOMONTH(TODAY(),-2)+1
RETURN
CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),'Table'[Date]>=_START&&'Table'[Date]<=MAX('Table'[Date])))+0

 Result is as below.

RicoZhou_0-1664180318441.png

 

Best Regards,
Rico Zhou

 

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
v-rzhou-msft
Community Support
Community Support

Hi @adk79 ,

 

Here I create a sample to have a test and I think you can try below code to create a measure.

Sample:

RicoZhou_1-1664180328719.png

Measure:

Measure = 
VAR _START = EOMONTH(TODAY(),-2)+1
RETURN
CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),'Table'[Date]>=_START&&'Table'[Date]<=MAX('Table'[Date])))+0

 Result is as below.

RicoZhou_0-1664180318441.png

 

Best Regards,
Rico Zhou

 

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

Thank you @v-rzhou-msft , it worked perfectly. I really appreciate it

TypimWuerfel
New Member

Hi @adk79,

 

I see two issues there.

First one to solve is the date filter. I used a variable, where I filtered the Sales by TodayM-1.
Second issue is much easier as you can cumulated the variable as any other cumulated sum by filtering allselected dates with isonorafter(Date, max(date), descendants).

I hope this one helps you:

Cumulated Values = 

var SalesfromMminus1 = Calculate(Sum(Sales[Sales]),Filter('Dim Datum','Dim Datum'[DatumBK] >= DATE (YEAR (TODAY()), MONTH ( TODAY () ) - 1, DAY ( TODAY () - 1 ) )))
return
CALCULATE(
	SalesfromMminus1,
	FILTER(
		ALLSELECTED('Dim Datum'[DatumBK]),
		ISONORAFTER('Dim Datum'[DatumBK], MAX('Dim Datum'[DatumBK]), DESC)
	)
)

____________________________

You want more helpful tipps and tricks like that?
Please subscribe: https://www.youtube.com/channel/UC2lAgCgfyLCHsRv0h-ETBWQ 
 

Hello @TypimWuerfel 

 

Thank you for your reply. However, the measure doesn't work and it returns the same value as the non cumulated. Please note that my measure that I want to comulate is as follows (I don't know if this changes anything) : 

 

CALCULATE([Value],PARALLELPERIOD('D_Calendar'[Date],1,MONTH))

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.