Skip to main content

When I make a calculated field in Prep using a field with a type change, the data does not appear in the reulting datasource. For example, I had a Datetime field that showed the amount of time something took. I converted it to a string, then added the minutes and the hours (times 60) to get the total number of minutes the event took. Everything looks great in the flow. When I run the flow and open the datasource (or open a workbook based on the datasource), no data appears for that column. It's all Null. This has happened repeatedly recently, allways when I have converted the field type and made a calculation. Any suggestions? Is this happening for anyone else? 

 

All my data is highly confidential, so I cannot share it here.  

 

#Tableau Prep

5 answers
  1. Apr 8, 11:35 PM

    @Kate Ory

     

    Hi, could you paste a screenshot of the changes section of the clean step so we can take a look of what you are doing, and suggest and alternative. 

     

    My best understanding, is that you are converting your datetime field to string using: 

    STR([yourdatetimefield]) 

     

    (Maybe you are using the automatic conversion by clicking on the data type icon an selecting string.  Sometimes automatic conversion may cause errors, so that I prefer to use STR([Field]) 

     

    And then you are extracting the parts of the string related to the hour and minutes, and then you are converting them to INT, and finally multiplying and adding them to obtain the total duration in minutes. 

     

    As a workaround, I suggest you to use your datetime directly (it should be a datetime data type field), and obtain the dateparts using something like:

    DATEPART('hour', [yourdatetimefield]) * 60 + DATEPART('minute', [yourdatetimefield])

     

    If this post resolves the question, would you be so kind to "Accept this Answer"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you. 

     

    Regards, 

     

    Diego Martinez 

    Tableau Visionary and Tableau Ambassador 

0/9000