# Percent in Dax

• ### Question

• I have a table that looks like this:

 Sales Month Year Full Date 100 4 2015 Apr-15 110 5 2015 May-15 145 6 2015 Jun-15 130 7 2015 Jul-15 133 8 2015 Aug-15 158 9 2015 Sep-15 200 10 2015 Oct-15 160 11 2015 Nov-15 130 12 2015 Dec-15 133 1 2016 Jan-16 158 2 2016 Feb-16 200 3 2016 Mar-16 200 4 2016 Apr-16 111 5 2016 May-16

...and what I need is a measure that gives me %change YoY.  So if I add a slicer, and select Jan, it will tell me % difference.  Any ideas?

Thanks

Wednesday, April 27, 2016 4:07 PM

• Hi TheOtherMe,

According to your description, you need to calculate the difference between current month and this month last year, right?

If that is the case, you can get the sales in last year, you can use the DAX expression below.
=LOOKUPVALUE(Change[Sales],Change[Year],Change[Year]-1,Change[Month],Change[Month])

And then you can calculate the percentage of the change.

Regards,

Charlie Liao
TechNet Community Support

• Proposed as answer by Wednesday, May 4, 2016 2:26 PM
• Marked as answer by Thursday, May 5, 2016 3:17 PM
Thursday, April 28, 2016 6:59 AM

### All replies

• Something like:

`=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]), PREVIOUSYEAR('DateTime'[DateKey]))`

See PREVIOUSYEAR function here:

https://msdn.microsoft.com/en-us/library/ee634770.aspx

Wednesday, April 27, 2016 5:03 PM
• Hi TheOtherMe,

According to your description, you need to calculate the difference between current month and this month last year, right?

If that is the case, you can get the sales in last year, you can use the DAX expression below.
=LOOKUPVALUE(Change[Sales],Change[Year],Change[Year]-1,Change[Month],Change[Month])

And then you can calculate the percentage of the change.

Regards,

Charlie Liao
TechNet Community Support

• Proposed as answer by Wednesday, May 4, 2016 2:26 PM
• Marked as answer by Thursday, May 5, 2016 3:17 PM
Thursday, April 28, 2016 6:59 AM
• Actually, PREVIOUSYEAR returns the whole previous year. You will probably want to use SAMEPERIODLASTYEAR instead, which returns, well, the same period last year.
Thursday, April 28, 2016 3:59 PM