Domanda

BO Version: 12.1.0 on Infoview, O/S: W7

I am creating a report in infoview, which is a cross-tab. I have departments on the row side and for the column I want to have all Saturday dates dynamically displayed, and this is dependent on the date prompt values I put in to the report when I run it.

So if I put in for the prompts Dec the 08th 2013 to Jan the 04th 2014 I should see 4 Saturday dates (14th/21st/28th/04th) along the column headers.

I started off using a variable and using the function relativedate, which gave me all the dates I wanted:

=RelativeDate(LastDayOfWeek([Query 1].[Episode End Date]);-1)

but because I used -1 to get the Saturday date it was giving me the Saturday before the earliest prompt date, so I was getting these dates instead:

(07th/14th/21st/28th/04th)

Is there a way I can get these dates but ignore the previous day (the 7th) before the start prompt date?

I want to have this dynamic so that if I put a date range in it shows me all the saturday dates within that range along the top of the report regardless of the date range period.

Andrew

È stato utile?

Soluzione

The reason you're having trouble is that WebI (being ISO compliant) considers a week to run from Monday to Sunday, but your reporting week ends on Saturday.

So, I would approach it this way:

=RelativeDate(
    LastDayOfWeek(
        RelativeDate([Query 1].[Episode End Date];1)
    )
 ;-1)

If we evaluate some dates with this logic, we'll see the desired result:

Testing 12/8 (Sunday):

  1. Add one day = 12/9
  2. Get Last Day Of Week = 12/15
  3. Subtract one day = 12/14

Testing 12/12 (Thursday)

  1. Add one day = 12/13
  2. Get Last Day Of Week = 12/15
  3. Subtract one day = 12/14

Testing 12/14 (Saturday)

  1. Add one day = 12/15
  2. Get Last Day Of Week = 12/15
  3. Subtract one day = 12/14

I'm at home and don't have access to WebI right now, so I can't test this myself, but the logic should be sound.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top