1 Reply Latest reply on Dec 9, 2019 4:45 PM by indy poo

    MTD WTD Currenr Day and Previous Day formula validations in Tableau

    indy poo

      Hi ,

       

      I am trying to  calculate MTD,WTD and current day and previous day in tableau for a particular measure.

       

      As per the example 

       

       

       

       

      I calculated similarly in tableau with the formulas

       

      Current KPI

      IF max(DATEDIFF('day', [Schedulerundate],TODAY())=0) THEN

      [OTP% - Station]

      END

       

      Previous KPI

       

      IF max(DATEDIFF('day', [Schedulerundate],TODAY())=1) THEN

      [OTP% - Station]

      END

       

      WeektoDate;

      IF

      max(DATETRUNC('week', [Schedulerundate]) = [Latest Week])

      then [OTP% - Station]

      END

       

      Here Latest week is  DATE(DATETRUNC('week', [Latest Date])) 

       

      Latest Date means  { FIXED :MAX([Schedulerundate])}

       

      MonthtoDate:

      IF MAX([Schedulerundate])<= TODAY() AND DATEDIFF('month', MAX([Schedulerundate]),TODAY())=0 THEN

      [OTP% - Station]

      END

       

       

       

      My tableau output is here with teh screenshot

       

       

       

       

      Can anyone please validate my formulas deinfed as per my inital example.

       

      I am not using any parameters here. The data available in the workbook is upto Dec 04, data is not uptodate.But the formulas need to work for current data in future.

       

      Not sure which approcah sgould be good, like using any parameters ...

       

      Anyone please advise.

       

      Thanks,

      Indy