1 2 Previous Next 18 Replies Latest reply on Apr 11, 2018 4:15 AM by chowdary v

# Calculate YTD sales Dynamic?

Hi All,

I need to calculate YTD sales Dynamically.

without parameter it is working fine.

But when i add parameter to Calculated field its throwing an error.

Formula:-

if [Order Date]<=[YTD Parameter]

AND

DATEDIFF('year',[Order Date],[YTD Parameter])=0

THEN [Sales] END

The problem is with Parameter Data type ie INT

I tried to Convert [YTD Parameter] using DATETIME.

Formulla

if [Order Date]<=DATETIME([YTD Parameter])

AND

DATEDIFF('year',[Order Date],DATETIME([YTD Parameter]))=0

THEN [Sales] END

Its giving NULL value

Any Help?

• ###### 1. Re: Calculate YTD sales Dynamic?

STEP 1

Makedate

=MAKEDATE([YTD Parameter],12,31)

STEP 2

if [Order Date]<= [MakeDate]  AND

DATEDIFF('year',[Order Date],[MakeDate])=0

THEN [Sales] END

Thanks,

Ritesh

1 of 1 people found this helpful
• ###### 2. Re: Calculate YTD sales Dynamic?

hi,

here i attached please check

1 of 1 people found this helpful
• ###### 3. Re: Calculate YTD sales Dynamic?

Thanks for the reply

Its working with SUperstore Data

but when i am trying to apply same in my original Data source.

surprisingly its showing an error.

• ###### 4. Re: Calculate YTD sales Dynamic?

Hi Chowdary.

Thanks for the reply.

i am unable to open the workbook

I have 10.2

• ###### 6. Re: Calculate YTD sales Dynamic?

I think the only problem you have here is the wrong parameter selection , you don't need to do what I did above but just select like this

NATURE OF PARAMETER SHOULD BE DATE

• ###### 7. Re: Calculate YTD sales Dynamic?

I did it in that way already.

But the problem is in Parameter values should be 2013, 2014. 2016...

like that.

But if i go by you suggestion Parameter Values will be 26/01/2013 like that.

• ###### 8. Re: Calculate YTD sales Dynamic?

Ok THEN Download Version 1 here Tableau Public

Thanks,

Ritesh

• ###### 9. Re: Calculate YTD sales Dynamic?

I am unable to open the file.

Instead of MAKEDATE is there any alternate way to do it like.

Plz help me . Urgent

• ###### 10. Re: Calculate YTD sales Dynamic?

Hi Pavan,

first u can create paramet,

after that, u can write make date function

• ###### 11. Re: Calculate YTD sales Dynamic?

after that u can use this,

• ###### 12. Re: Calculate YTD sales Dynamic?

Hi Chowdary

I did the same thing MAKEDATE Function works only for Extracts.

But here i have LIVE Connection.

Is there other way instead of MAKEDATE like DATEPARSE?

• ###### 13. Re: Calculate YTD sales Dynamic?

i think in live makedate is not working

• ###### 14. Re: Calculate YTD sales Dynamic?

already i attached one workbook above please check that one

1 2 Previous Next