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

Current month vs last year's current month

Hello, im trying to do some calculations with value from current month  and compare it with las years same month as i refresh my data.

I tried the following measure to get Sales from last year's march but, it only showed  total sales of 2018:

CALCULATE(sum(TableX[Sales]);YEAR(TableX[WorkDate]=2018);month(today())=MONTH(TableX[WorkDate))
Example Table:


2019-03-21 11_12_42-Libro1 - Excel.png

1 ACCEPTED SOLUTION

Accepted Solutions
v-danhe-msft Super Contributor
Super Contributor

Re: Current month vs last year's current month

Hi @hgzelaya ,

Based on my test, you could refer to below measures:

Previous = var a=YEAR(MAX('Table1'[WorkDate]))-1
return CALCULATE(SUM(Table1[Sales]),FILTER(ALL('Table1'),'Table1'[Year]=a))
Difference = CALCULATE(SUM(Table1[Sales]))-[Previous]

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
HotChilli New Contributor
New Contributor

Re: Current month vs last year's current month

The measure looks ok. 

Here's my test

Annotation 2019-03-21 March.png

 

Quick tip : to get your questions answered , paste real data not a photo of the data

v-danhe-msft Super Contributor
Super Contributor

Re: Current month vs last year's current month

Hi @hgzelaya ,

Based on my test, you could refer to below measures:

Previous = var a=YEAR(MAX('Table1'[WorkDate]))-1
return CALCULATE(SUM(Table1[Sales]),FILTER(ALL('Table1'),'Table1'[Year]=a))
Difference = CALCULATE(SUM(Table1[Sales]))-[Previous]

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 326 members 2,895 guests
Please welcome our newest community members: