Forum

Filter of some peri...
 
Notifications
Clear all

Filter of some period, and get the information from the previous 12 months

12 Posts
2 Users
0 Reactions
49 Views
(@goncas)
Posts: 6
Active Member
Topic starter
 

I haFinancial data from 4 years, and I want to get the information based on Time filters, for instance Nobvember 2016, and I need to get a line graph with this date, but from December 2015 to November 2016. It menas allways 12 month's before the date I choose.

I'm completly bloked, can someone give me ahelp on this?

 
Posted : 19/12/2017 11:09 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Carlos,

You need to write a DAX measure using the time intelligence function PARALLELPERIOD. It doesn't look like you did the Power Pivot course to learn the DAX functions. Did you already know how to use Power Pivot?

What have you tried so far, do you have a DAX Formula you've tried?

Also, it's difficult to help without knowing your model, so it would help if you can share the model, or at least screenshots.

Mynda

 
Posted : 19/12/2017 7:27 pm
(@goncas)
Posts: 6
Active Member
Topic starter
 

I send one example file of what I need (it is a zip file)

 

If you do not receive, you can try my onedrive sharing folder, the link is:

 

https://1drv.ms/f/s!AnON5XxufzhJju9plyZTpeAjc_YOBA

 

Many thanks for your support

 
Posted : 22/12/2017 7:49 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Carlos,

Thanks for sharing the files.

In the attached file you'll see I've added a measure called Prior Year Measure, which uses the PARALLELPERIOD DAX function to calculate the values at a month level for the period 12 months prior. I also inserted a table and line chart that shows the measure is calculating correctly.

Your custom visual looks a little odd because the measure is calculating the total for a month at a time, but the date axis is at day level, so the prior year values appear like a stepped chart. It might be better to use the built in visuals for this data.

To use the time intelligence DAX functions you need a set of consecutive dates in your model. Your KPI Values don't have a date for every day, so I added a Dates table and used that for the Date fields in the measure and visuals.

It looks like you need to learn the Power Pivot side of Power BI so you can write custom measures and understand the modelling requirements. Let me know if you'd like to add the Power Pivot course to your bundle.

Kind regards,

Mynda

 
Posted : 24/12/2017 12:13 am
(@goncas)
Posts: 6
Active Member
Topic starter
 

Hi Mynda

 

Almost there

 

I need to present anytime 12 months from the period I selected, for instance, if I select October 2016, I need to show from September 2015 to October 2016, other example, if I select  quarter 2 of 2016, I need to show July 2015 to June 2016, and always in an continuous line

 

But, you are wright, I need to learn the Power Pivot or also power query. I will do that for next year

 
Posted : 24/12/2017 3:35 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Carlos,

You should use the regular Slicer (not the custom one) and use the 'Between' dates option if you want to choose flexible dates that also update the PARALLELPERIOD measure.

See session 4.06 of the Power BI course for the Slicer options. You might also find the relative slicer useful.

Mynda

 
Posted : 24/12/2017 9:00 pm
(@goncas)
Posts: 6
Active Member
Topic starter
 

Yes, I know, but this is not what I want

 

The user must only select a period for evaluation, not using a slide with the options between dates.

 

That's one of the problem, and the rest should be automatically, presenting a full 12 mounts, and the selected date act only as a reference to do that

Maybe not so easy, I hope you can give me a clue

 
Posted : 25/12/2017 7:25 am
(@mynda)
Posts: 4761
Member Admin
 

I don't think it can be done. The chart requires a date field in the Axis. You need a DAX measure that returns a table that lists the dates prior to a period you select. You can't use a DAX measure in the Date axis for the chart because the DAX function needs context, AFAIK.

You'll have to educate your users to use the Slicer. Have you tried the relative Slicer where you can choose the 'Last' 1 'Year', or the 'Last' 6 'Months' etc. When you use the 'Prior Year Measure' with the 'Actual' and 'Budget' you get the results you describe.

Mynda

 
Posted : 25/12/2017 7:49 pm
(@goncas)
Posts: 6
Active Member
Topic starter
 

Hi Mynda

 

Thanks for your support

 

I already get help on another site, and seems that solution provide to me, is like I need

It's necessary yo have an table with dates and then a new measure using DAX, but with a more convenient approach.

 

But, thank you very much for your involvement with this issue

 
Posted : 27/12/2017 6:02 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Carlos,

Yes, I advised you of the need for a dates table at the beginning.

I'm not sure what you mean by 'I already get help on another site'. Did you find a different solution, if so please share it here.

In future, if you post your question on multiple forums you should declare that you've done so, both here and the other places you post. Forum helpers get very annoyed about duplicating effort.

Mynda

 
Posted : 28/12/2017 9:00 am
(@goncas)
Posts: 6
Active Member
Topic starter
 

This is what I get:

 

In the solution below, you need an independent date table.  (No relationship with other tables.).

Indicator =
CALENDAR ( DATE ( 2014, 1, 1 ), DATE ( 2017, 12, 31 ) )


Then create a measure like this:

MeasureActual =
IF (
    MIN ( 'KPI Values'[Date] )
        >= FIRSTDATE (
            DATESINPERIOD ( 'Indicator'[Date], MAX ( 'Indicator'[Date] ), -1, YEAR )
        )
        && MIN ( 'KPI Values'[Date] ) <= MAX ( 'Indicator'[Date] ),
    SUM ( 'KPI Values'[Actual] ),
    BLANK ()
)
 
Posted : 29/12/2017 2:30 pm
(@mynda)
Posts: 4761
Member Admin
 

Thanks for sharing, Carlos.

 
Posted : 29/12/2017 8:28 pm
Share: