Question

Is there a way to change the default value of the Time Intelligence Post Formula??

I have a Dashboard where I use From Date and To Date filters, to calculate the values between the user selected period, for those filters I use the Time Intelligence Post Formula,however the default when the user enters the page is always today's date on both filters. (and from today to today analysis doesn't make sense for this)

What I would like to to is have a From Date be something like 30 days before today's date, but not forced on the report receiving the filters, I just want the filter to have a default value and then let the user choose whatever he wants.

Anybody knows of something that can be done, or this just can't be done?

EDIT:

Throught research on this link showed me that it can't be done via Normal Ways:

sgrice asked this question: I love the calendar and the ease of linking it to my cube; however, we never have data for "Today" which is the default date. Therefore, our dashboards are always blank when they first come up and our client has to select a date. Is there a way to change the default date?

The author of the post says on a comment reply:

No sorry, but I will enter this as a feature suggestion.

Thanks,

Alyson

So there's no formal way of doing it so I'm trying to do this in another way. So I'm trying to do it in an more undocumented and obscure way, throught javascript. I would appreciate help on finding a way to do this.

Was it helpful?

Solution 3

I've solved it throught javascript and JQuery. I Basically checked what the calendar did, and reproduced it, I've realized it toogled the visibility of the calendar when you clicked on day, and since I wasn't interested on that i removed it, and called a method with this name pps_TI_calendar_render passing three parameters, one was the id of the calendar td, and the other two was the date you've selected in a complete name. I've checked if it would accept just two parameters, and the date in a simpler format the result is this javascript call (note that i'm only changing the first pps date calendar):

pps_TI_calendar_render(  $('.pps_calendarToggleDown').first().parent().closest('td').attr('id'),'01/01/2010');

(this date format is month/day/year) if you put for example 14/01/2010 it will place the calendar in february first of 2011. So Watch out.

NOTE In the first parameter I've used a JQuery selection to get the id I wanted, this could be changed, but the parameter needs to be the id of the element pps uses.

Hope this helps.

OTHER TIPS

Okay, I have followed this thread for a while and tried so many methods to get this to work, eventually I hacked my way through almost all the SP2010 and SP2007 JavaScript and found the following to work on SP2010 and I had it working in SP2007 with a different tad prefix.

Step 1: find out what the Javascript id prefix of your calendar parts are.

  • To do this, start your dashboard in IE8 or IE9 and hit F12 to start the Javascript Debugger.
  • User the Javascript GetElementByTagName("TD") to get a full list of all the TD tags on the page.
  • Look for the tags that have a GUID in the id and that end with _Selection and Selection_Toggle.
  • These will be your calendar filter parts. Note the starting prefix (in SP2007 it was ct_100_ in SP2010 it is pps_)

Step 2: add the following Javascript to the end of your master page which is used for the Dashboards (look at end of the post)

Step 3: save the master page and refresh your browser and the date should change to yesterday.

I have also created this for a dashboard with two calendar filters on it to allow for date range filtering and this will set the first date to 11 days earlier and the second date to yesterday. Any Questions emil.swanepoel@live.co.za

<script type="text/JavaScript">


var isFirstLoad;
var calendarLoaded = false;
var srcID = "ctl00_m_WebPart_293af46d1c5c4320893d47f86614325bSelection";
var strDate = "Tue Aug 2 00:00:00 UTC+0200 2011";
var t;
var dateBackA = 1;
var dateBackB = 10;
testForCalendar();

function testForCalendar()
{
    isFirstLoad = true;
    if(calendarLoaded != true)
        t = setTimeout("waitForIt()", 5);
}

function waitForIt()
{
    var foundControl = -1;
    var t = document.getElementsByTagName("TD");
    var ts = "";
    var subDateFound = false;
    var xPoint = 0;
    for(var x = 0; x < t.length; x++)
    {
        if((t[x].id.indexOf("pps_") == 0) && t[x].id.indexOf("Selection_Toggle") > 0)
        {
            foundControl = x;
            ts = t[x].id.substring(0, t[x].id.indexOf("_Toggle"));
            xPoint = x;
            x = t.length;
        }
    }
    if(foundControl > -1)
    {
        if(isFirstLoad == true)
        {   
            if(t[xPoint].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.innerHTML.indexOf("Start Date:") > -1)
                calendarIntercept(ts, calendarDate(new Date(), dateBackB));
            else 
                calendarIntercept(ts, calendarDate(new Date(), dateBackA));
            waitForItSub(xPoint, ts);
            calendarLoaded = true;
            isFirstLoad = false;
        }
        else
            t = setTimeout("waitForIt()", 5);
    }
    else
        t = setTimeout("waitForIt()", 5);   
}

function waitForItSub(startPoint, firstTag)
{
    var foundControl = -1;
    var t = document.getElementsByTagName("TD");
    var tsub = "";
    var xPointNew = 0;
    for(var x = (startPoint++); x < t.length; x++)
    {
        if(t[x].id.indexOf(firstTag) == -1)
        {
            if((t[x].id.indexOf("pps_") == 0) && t[x].id.indexOf("Selection_Toggle") > 0)
            {
                foundControl = x;
                tsub = t[x].id.substring(0, t[x].id.indexOf("_Toggle"));
                xPointNew = x;
                x = t.length;
            }
        }
    }
    if(foundControl > -1)
    {
        if(isFirstLoad == true)
        {   
            if(t[xPointNew].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.innerHTML.indexOf("Start Date:") > -1)
                calendarIntercept(tsub, calendarDate(new Date(), dateBackB));
            else
                calendarIntercept(tsub, calendarDate(new Date(), dateBackA));
            calendarLoaded = true;
            isFirstLoad = false;
        }
    }
}

function calendarIntercept(inSrcID, inDate)
{
    strDate = (inDate.getMonth()+1) + "/" + inDate.getDate() + "/" + inDate.getFullYear(); 
    pps_TI_calendar_render ( inSrcID, strDate , strDate );
}

function calendarDate(inDate, daysBack)
{
    var returnValue = new Date();
    returnValue.setDate(returnValue.getDate() - daysBack);
    return returnValue;
}

</script>

You have to create two calendars, and then map one to the start date and one to the end date. This is described in this comment on the Performance Point blog.

The technique is as follows:

To work with a start and end date you need to create 2 calendars. Then you link one calendar to <> and the other to <>. As formula you just enter Day:Day. In the report you will have to create a set called 'DateRange' or something similar.

WITH 
SET [DateRange] AS
   <<StartDate>>.Item(0) :  <<EndDate>>.Item(0)
SELECT
NON EMPTY 
[DateRange]
ON COLUMNS,
{ [Measures].[Price Total] }
ON ROWS
FROM [TurnoverCube]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top