cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jayanthan Member
Member

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
Larstc Regular Visitor
Regular Visitor

Re: Dynamic Previous Year Sales

Have you tried SAMEPERIODLASTYEAR ?

 

E.g.

Calculate(

(sum

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

)

jayanthan Member
Member

Re: Dynamic Previous Year Sales

hi Larstc 

 

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

 

 

Regards

Jayanthan

Helpful resources

Announcements
Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors