Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

How to dynamic change the 365 days if now is June , it change to 180 (30*6)Hi All

Hi All

I have a Table only Row one display wrong value.

The rest of the Row display correct value because my dimension is year , and it allow multiply by 365.

My first row YTD only 5 month , it should be 30*6=180 day not 365 days.

May i know how to make use of script to dynamic change the days ?

I expected to get 28.8 . ( 0.16 * 30 * 6 )

Now it display 58 ( 0.15 * 365 )

Paul

1 Solution

Accepted Solutions
sunny_talwar

May be this:

If(Month(Date(Max({<sales = {'>0'}>}Date))) = 12, 365, ((Month(Date(Max({<sales = {'>0'}>}Date))) + 1) * 30))

View solution in original post

3 Replies
paulyeo11
Master
Master
Author

my QVF

sunny_talwar

May be this:

If(Month(Date(Max({<sales = {'>0'}>}Date))) = 12, 365, ((Month(Date(Max({<sales = {'>0'}>}Date))) + 1) * 30))

paulyeo11
Master
Master
Author

Hi Sunny

Many thank for your below expression , it work fine :-


If(Month(Date(Max({<sales = {'>0'}>}Date))) = 12, 365, ((Month(Date(Max({<sales = {'>0'}>}Date))) + 1) * 30))


it also allow me to change +1 to +0 :-

If(Month(Date(Max({<sales = {'>0'}>}Date))) = 12, 365, ((Month(Date(Max({<sales = {'>0'}>}Date))) + 0) * 30))


and above return will return 150 days instead of 180 days this is what i need.

By the way I also notice that your above SET expression also will change when user select month = 1 and year =2016 , it will display 30.

Very powerful , but i am unable to understand how it work. i only Guees :-


If(Month(Date(Max({<sales = {'>0'}>}Date))) = 12, 365

Above will display 365 when it check month have month =12 have sales. As script have sales >0


((Month(Date(Max({<sales = {'>0'}>}Date))) + 1) * 30))

Above will return current month number multiply by 30 ( 6*30=180) , it detect current month sales >0 is June , so

it is correct ?it return 6 , as July sales =0 in year = 2016

Am i correct ?


Paul