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
RMV
Helper V
Helper V

balance of end of previous year

Hi, 

I'm trying to create a line graph to show 2 values, with month as axis

1. accumulated value per month in current year

2. accumulated value from the first date of transaction (could be more than a year ago) until the end of previous year to be shown constant to all month in the graph

Note: these 2 values must be able to be filtered by month & other categories.

 

I have a difficulty in applying a correct formula for value #2 that should not be affected by the month filter

I cannot use ALL function, considering the Note above.

anyone can help me what formula I should use?

 

below is the graph I'm looking for.

graph.jpg

 

Really appreciate help.

1 ACCEPTED SOLUTION

Hi @RMV,

 

See if my solution here helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi @RMV,

 

Share the link from where i can download your file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Anonymous, I need the previous year figure not to be affected by the month filter applied. Only the current year figure is affected by the month filter.

 

@Ashish_Mathur, sorry I cannot share my pbix here.

I provide some data samples below, though.

 

The raw data sample is as follow

EntityDateCategory 1Category 2Amount
130-Apr-15A1B11000
14-Jun-15A1B2200
225-Sep-15A1B157
28-Dec-15A2B160
13-Feb-16A1B2500
19-Aug-16A2B1700
231-Oct-16A1B145
24-Nov-16A1B270
111-Jan-17A2B11200
122-Feb-17A1B11300

 

And the result expected, with only month filter applied is as follow

Entity        All                  Category 1      All

Month      Jan-Feb          Category 2      All

 

 Current YearPrevious Year
Jan38322632
Feb51322632

 

Where, Jan previous year is calculated from all 2016 values and before (1000 + 200 + 57 + 60 + 500 + 700 + 45 + 70)

Feb previous year is calculated the same as Jan previous year values

Jan current year is calculated from Jan 2017 values and before (1000 + 200 + 57 + 60 + 500 + 700 + 45 + 70 + 1200)

Feb current year is calculated from Feb 2017 values and before (1000 + 200 + 57 + 60 + 500 + 700 + 45 + 70 + 1200 + 1300) 

 

When some other filters applied, the result expected is as follow

Entity        1                  Category 1      All

Month      Jan               Category 2      B1

 

 Current YearPrevious Year
Jan22001700
Feb 1700

 

Jan Previous Year is calculated with 2016 values and before for Entity 1 & Category 2 = B1 (1000 + 700)

Feb Previous Year is calculated the same as Jan Previous Year

Jan Current Year is calculated with Jan 2017 values and before for Entity 1 & Category 2 = B1 (1000 + 700 + 1200)

Feb Current Year is showing blank, since the month is filtered to Jan only

Hi @RMV,

 

See if my solution here helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur

 

Wonderful! It works.

Thanks a lot for the help.

 

Regards,

You are welcome.  If my reply helped, please mark it as Answer.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Try this:

 

Cumulative For Last Year = 
VAR StartingMonth = MIN(Calendar[Month]) 
VAR EndingMonth = MAX(Calendar[Month])
VAR CurrentYear = MAX(Calendar[Year])
VAR LastYear = CurrentYear - 1
RETURN
CALCULATE(
	[Sum Measure],
	Filter(
		ALL(Calendar),
		Calendar[Year] = LastYear
		  && Calendar[Month] >= StartingMonth
		  && Calendar[Month] <= EndingMonth
	)
)

This will listen to the month slicer and return all months within the the selected range, but only for last year.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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