cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
hgzelaya Frequent Visitor
Frequent 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
Community Support Team
Community Support Team

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.
2 REPLIES 2
HotChilli Established Member
Established Member

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

Community Support Team
Community Support Team

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.