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
jayanthan
Helper III
Helper III

Dynamic Previous Year Sales

Hi All

 

how can i create a dynamic previous year sales

 

E.g if i select 2015, i need to retrieve 2014 sales, if i select 2014, i need to retrieve 2013 sales. Also note my financial year ends on 31st March. 

 

I have tried with below DAX Function , but it didnt not work

 

1. 

PreviousYearbySelection

 

 VAR CurrentYear=

CALCULATE(FIRSTNONBLANK('Z_Power BI Date Template'[Year], ISFILTERED('Z_Power BI Date Template'[FinancialYear]) ))
Return
CurrentYear-1

 

2.Sales_Previous_Year_Selection =

CALCULATE

(sum

('Sales Comparison'[BaseSubTotal]),

filter ('Z_Power BI  Date Template','Z_Power BI  Date Template'[Year]=[PreviousYearbySelection]

)

)

2 REPLIES 2
Anonymous
Not applicable

Have you tried SAMEPERIODLASTYEAR ?

 

E.g.

Calculate(

(sum

('Sales Comparison'[BaseSubTotal]); SAMEPERIODLASTYEAR("yourdatetable";[date])

)

hi Larstc 

 

it will not work when financial year ends on 31st March

 

 

Regards

Jayanthan

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.