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
Anonymous
Not applicable

cumulative month for previous year

Hi Team, 

 

I am trying to work on the report where i am stuck . 

 

Filters: Months (jan,fev,march...dec)

Source Data contains fields for 2017,2018.

 

I need to create a chart for cumulative total sales for any month selected..  CY vs PY 

 

eg. Feb is selected 

          Total sales CY , Total Sales LY 

Jan          1000,             2000

Feb          1200,             1500

March      2000,             3000

April         4000,             2500

May          4500,             3000

 

day, 1Cumulative Amount CY,  2Cumulative Amount PY

1        10               blank 

2        30               blank 

3        100             

4         250             

5         400

..

27      1000

28     1200         blank

 

cumulative sales current year is calculating fine.. 

 

 

 

1Cumulative Amount CY = CALCULATE([Total Sales],
FILTER(ALLSELECTED(FSP),
FSP[Date_dt]<= MAX(FSP[Date_dt] ) && YEAR(FSP[Date_dt])=YEAR(TODAY())))

 

 

date_dt is date heirarachy.

calculated measure: total sales =sum(table[sales]) 

 

I created a similar for last year :

2Cumulative Amount PY = CALCULATE([Total Sales],
FILTER(ALLSELECTED(FSP),
FSP[Date_dt]<= MAX(FSP[Date_dt] ) && YEAR(FSP[Date_dt])=YEAR(TODAY()-1)))   ==> filtered for last year 

 

also tried this 

2Cumulative Amount PY = CALCULATE([total sales ly],
FILTER(ALLSELECTED(FSP),
FSP[Date_dt]<= MAX(FSP[Date_dt] ) ))  ==> coming blank 

 

calculated measure : total sales ly = CALCULATE(SUM(FSP[Sales]),PREVIOUSYEAR(FSP[Date_dt].[Date]))

this is giving correct ammount for each month 

 

but this is giving the sames result for all the days 

 

Link: (screenshot) 

 https://drive.google.com/file/d/1XsSlmR0jON8BBduCfuwt2pG_gStHXG49/view?usp=sharing

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI Team, 

 

I actually resolved this !! 

 

2Cumulative Amount PY = CALCULATE([total sales ly],
FILTER(ALLSELECTED(FSP),
FSP[Date_dt]<= MAX(FSP[Date_dt] ) ))

 

but now have faced another issue; which i ll be posting. 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

HI Team, 

 

I actually resolved this !! 

 

2Cumulative Amount PY = CALCULATE([total sales ly],
FILTER(ALLSELECTED(FSP),
FSP[Date_dt]<= MAX(FSP[Date_dt] ) ))

 

but now have faced another issue; which i ll be posting. 

 

AlB
Super User
Super User

Hi @Anonymous

 

Would it be possible for you to share the pbix file? It'd be much easier and quicker for people to help.

Just as an initial thought, if the current year one is working, have you tried the functionSAMEPERIODLASTYEAR( ) ?

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.