11 Replies Latest reply: Jul 4, 2014 3:45 AM by Harshana Etampawala

# Current Period and Last year Same Period

Hi

I am preparing a dashboard for compare profit and loss for this year vs last year.Depend on the year selection I want to display current period and last year same period in the other column but it doesn't seems to work.

Can someone give me a hand on this?

Thank you

Harsh

• ###### Re: Current Period and Last year Same Period

sum({<Year={\$(=Max(Year)-1)},Period=>}Amount)

Try that.

• ###### Re: Current Period and Last year Same Period

I have tried that. it didn't work.

• ###### Re: Current Period and Last year Same Period

Current period  : sum({<Period={\$(=Max(Period))}>}Amount)

last year same period: sum({<Period={\$(=Max({<Year={\$(=Max(Year)-1)}>}Period))}>}Amount)

hope this helps

• ###### Re: Current Period and Last year Same Period

HIC

• ###### Re: Current Period and Last year Same Period

There was extra "=" and you don't want to have that "Period=" there as it ignores all selections from Period dimension.

• ###### Re: Current Period and Last year Same Period

Hi Harsh,

Please find the attached QVW file for solution.

Regards,

@vi

• ###### Re: Current Period and Last year Same Period

Create 2 Expressions:

1)  For Current Year

num(Sum({<Year={\$(=max(Year))},Month={"<=\$(=max({<Year={\$(=max(Year))}>} Month))"}>}Sales),'#,##0')

2) For Previous Year Same Period

num(Sum({<Year={\$(vLastYr)},Issue_Date={"<=\$(=date(SetDateYear((today()-1),max(Year-1)), 'DD-MM-YYYY'))"}, Month >}Sales),'#,##0')

Where vLastYr=max(Year)-1  (Create a variable)

The Data will change as per the Selections done in the Year List Box.

Regards

Aviral Nag

• ###### Re: Current Period and Last year Same Period

See the attached file

• ###### Re: Current Period and Last year Same Period

Hi Mohit

I want to explain this bit more.

I am using valuelist in my dimension for grouping purpose. It is as below.

ValueList('Direct Income','Direct Expense','Gross Profit','Other Expense','Profit Before Other Income','Other Income','Net Profit')

So in my expression I am using as below.

if

(

ValueList('Direct Income','Direct Expense','Gross Profit','Other Expense','Profit Before Other Income','Other Income','Net Profit')='Direct Income' ,

sum({<Year={'\$(=vPYear)'},Period={'=\$(=vMaxMonth)'}>}Amount))

but it doesn't seems to work.

Harsh

• ###### Re: Current Period and Last year Same Period

Thanks a lot

It is working for the above.