cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
evpote01
Regular Visitor

Measure for Previous Year's Data

Hello!

 

I have a question that I think will be simple to answer, but I can't seem to figure out the correct solution.

 

I have a variable, Year, as a slicer on my dashboard. 

 

I have already created a measure called Cost per Client which was done by doing Cost per Client = DIVIDE(SUM('Table'[dollars paid]), [Client Count])

 

I am wanting to also display Cost per Client for the previous year, but want to keep my Year slicer for other data fields that I have. Year is the only date field that my data has. Is there a way to calculate Cost per Client for the previous year?

 

Thank you in advance!

1 ACCEPTED SOLUTION
evpote01
Regular Visitor

Thank you for the help!

 

I was able to get it done by doing 

CALCULATE([Cost per Client], REMOVEFILTERS(Table[year]),PREVIOUSYEAR(Table[date]))
 
where the date variable was in the mm/dd/yyyy format.

View solution in original post

2 REPLIES 2
evpote01
Regular Visitor

Thank you for the help!

 

I was able to get it done by doing 

CALCULATE([Cost per Client], REMOVEFILTERS(Table[year]),PREVIOUSYEAR(Table[date]))
 
where the date variable was in the mm/dd/yyyy format.

View solution in original post

Raymundo2910
Resolver III
Resolver III

Sure you can through Time Intelligence functions with DAX, you'll only need a Date column/field. 

https://docs.microsoft.com/en-us/dax/previousyear-function-dax Look for the example in that link, basically it is what you are trying to achieve. It would be something similar to P_Year = CALCULATE( [Cost Per Client], PREVIOUSYEAR(Table[DateColumn])

 

Similar functions you can consult as well:

https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax 

https://docs.microsoft.com/en-us/dax/parallelperiod-function-dax 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!