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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
farmentano11
Frequent Visitor

How to make a monthly comparison between year and previous year

Hi, I have an issue with R12 calculation (that must calculate de sum of the last 12 months). The problem is when I want to compare R12 of one year vs R12 of previous year. If a use month(january, february, etc.) they are not sorted.
The solution for me (I aceppt any others) is to calculate a measure that in september 2018, calculate de sum of september 2017. 
I attach de PBI file and to images that show you what i am looking for. 
Thanks a lot ! 

 

farmentano11_0-1695739568399.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @farmentano11 ,

 

Here are the steps you can follow:

1. Create calculated column.

Mes.Ao = 'Table'[Date]

Select [Mes.Ao] – Column tools – Data type : Date/Time – Format : March 2001.

vyangliumsft_0-1695888251210.png

2. Create measure.

year_month =
SUMX(
    FILTER(ALL('Table'),
    YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&
    MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[Value])
year_month_last =
SUMX(
    FILTER(ALL('Table'),
    YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))-1&&
    MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[Value])

3. The Place the fields in the line graph.

vyangliumsft_1-1695888251213.png

Format visual – X-axis – Type – Categorical.

vyangliumsft_2-1695888319270.png

4. Result:

vyangliumsft_3-1695888319277.png

 

 

Best Regards,

Liu Yang

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
Anonymous
Not applicable

Hi  @farmentano11 ,

 

Here are the steps you can follow:

1. Create calculated column.

Mes.Ao = 'Table'[Date]

Select [Mes.Ao] – Column tools – Data type : Date/Time – Format : March 2001.

vyangliumsft_0-1695888251210.png

2. Create measure.

year_month =
SUMX(
    FILTER(ALL('Table'),
    YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&
    MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[Value])
year_month_last =
SUMX(
    FILTER(ALL('Table'),
    YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))-1&&
    MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[Value])

3. The Place the fields in the line graph.

vyangliumsft_1-1695888251213.png

Format visual – X-axis – Type – Categorical.

vyangliumsft_2-1695888319270.png

4. Result:

vyangliumsft_3-1695888319277.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

Its work! Thanks a lot

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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