cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
fcarvalho Resolver II
Resolver II

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

Accepted Solutions
fcarvalho Resolver II
Resolver II

Re: Last 12 months

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
fcarvalho Resolver II
Resolver II

Re: Last 12 months

Anyone?
Super User I
Super User I

Re: Last 12 months

Hi @fcarvalho

 

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-...

 

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!
Microsoft
Microsoft

Re: Last 12 months

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

fcarvalho Resolver II
Resolver II

Re: Last 12 months

Sorry, I didn't explain myself very well.

 

What i really want is a chart like this:

 

1.JPG

Microsoft
Microsoft

Re: Last 12 months

@fcarvalho

 

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

fcarvalho Resolver II
Resolver II

Re: Last 12 months

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

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We've launched a how-to forum where you can learn about how Power BI integrates with other Power Platform products.

Top Solution Authors
Top Kudoed Authors