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

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

 

Capture.PNGMonthly Comparison

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

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.

Capture.PNG

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.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

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.

Capture.PNG

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.

View solution in original post

Community Support Team
Community Support Team

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.
Alirezam Regular Visitor
Regular Visitor

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'

 

Capture.PNG

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 Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

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: 424 members 3,894 guests
Please welcome our newest community members: