cancel
Showing results for
Did you mean:
Helper II

## Difference between two years

Hello,

I need to know how much the value changed on monthly basis. For example, if I select "Laundary", I like to view how much annual difference percentage was between 2017 and 2018. The question is how to calculate this "new measure"?

How can I show the monthly difference percent on top of each month on this bar chart?

I need this new measure get updated based on my selection from the slicers as well.

Many Thanks

Monthly Comparison

1 ACCEPTED SOLUTION

Accepted Solutions
Resident Rockstar

## Re: Difference between two years

Hi @Alirezam ,

For your requirement, we could create the measure below to achieve it.

```Measure =
VAR minyear =
CALCULATE (
SUM ( Table1[Sales] ),
FILTER (
'Table1',
YEAR ( 'Table1'[Date] ) = YEAR ( MIN ( 'Table1'[Date] ) )
&& MONTH ( 'Table1'[Date] ) = MONTH ( MAX ( 'Table1'[Date] ) )
)
)
VAR maxyear =
CALCULATE (
SUM ( Table1[Sales] ),
FILTER (
'Table1',
YEAR ( 'Table1'[Date] ) = YEAR ( MAX ( 'Table1'[Date] ) )
&& MONTH ( 'Table1'[Date] ) = MONTH ( MAX ( 'Table1'[Date] ) )
)
)
RETURN
( maxyear - minyear ) / maxyear
```

Then we could create a line and clusterd column chart like below.

More details, please refer to my attachment.

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
Resident Rockstar

## Re: Difference between two years

Hi @Alirezam ,

For your requirement, we could create the measure below to achieve it.

```Measure =
VAR minyear =
CALCULATE (
SUM ( Table1[Sales] ),
FILTER (
'Table1',
YEAR ( 'Table1'[Date] ) = YEAR ( MIN ( 'Table1'[Date] ) )
&& MONTH ( 'Table1'[Date] ) = MONTH ( MAX ( 'Table1'[Date] ) )
)
)
VAR maxyear =
CALCULATE (
SUM ( Table1[Sales] ),
FILTER (
'Table1',
YEAR ( 'Table1'[Date] ) = YEAR ( MAX ( 'Table1'[Date] ) )
&& MONTH ( 'Table1'[Date] ) = MONTH ( MAX ( 'Table1'[Date] ) )
)
)
RETURN
( maxyear - minyear ) / maxyear
```

Then we could create a line and clusterd column chart like below.

More details, please refer to my attachment.

Best  Regards,

Cherry

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

## Re: Difference between two years

Hi @Alirezam ,

Have you solved your problem?

If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

If you still need help, please feel free to ask.

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper II

## Re: Difference between two years

Hi, Thanks for your reply. I did what you said but still the line does not show anyting and sticks to the x-axis. Please note that I get [date] from another table named 'Calendar'

Announcements

#### New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

#### ‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

#### Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

#### Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

#### Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors