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

Last 12 months

Hi,

 

I want to know if it is possible choose one month from my slicer calendar, and then the chart shows last 12 months from 2 or more years.

 

Example: I choose Mai 2016, and then the chart shows jun 15 - mai 16 (12 months)

and if I had 2014, the charts shows another line from 2014 with the same period.

 

1.JPG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I followed this script: http://blog.crossjoin.co.uk/2013/11/19/generating-a-date-dimension-table-in-power-query/

 

used this calculated column

 

 

Ultimoano = if(AND([Date]>=[Today]-365;[Date]<=[Today] );"Último Ano";"Anterior")

and I got what I want.

 

 

1.jpg

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Sorry, I didn't explain myself very well.

 

What i really want is a chart like this:

 

1.JPG

@Anonymous

 

I don’t think it is possible to have a chart like you drew. In above chart, the X-Axis only has months without year specified, however you need one line in Y-Axis contains two years’ value. And the month order will not be like you desired with no year.

 

Best Regards,

Herbert

Anonymous
Not applicable

I followed this script: http://blog.crossjoin.co.uk/2013/11/19/generating-a-date-dimension-table-in-power-query/

 

used this calculated column

 

 

Ultimoano = if(AND([Date]>=[Today]-365;[Date]<=[Today] );"Último Ano";"Anterior")

and I got what I want.

 

 

1.jpg

Anonymous
Not applicable

Anyone?

Hi @Anonymous

 

You may check the link and see if it works for you.

 

http://community.powerbi.com/t5/Desktop/Show-last-13-months-based-on-user-single-slicer-selection/m-p/64214#M26525

 

You may have to build the measure for 2 years before making some changes to the formula for last 13 months.

 

If it works accpet this as a solution and also give KUDOS.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

A great solution… With matemusic's method, If we need the period from 2014, we can create another measure by only changing MAX ( 'Year'[Year] ) to MAX ( 'Year'[Year] ) - 1. But we need to put them into two different visual charts since the X-Axis is YearMonth.

 

Last 12 months_1.jpg

 

Best Regards,

Herbert

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.