Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Alirezam
Helper V
Helper V

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 ComparisonMonthly Comparison

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

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
v-piga-msft
Resident Rockstar
Resident Rockstar

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.
v-piga-msft
Resident Rockstar
Resident Rockstar

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.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.