Help with LEFT function in Beast Mode CASE Statement

I am having trouble with the LEFT function in a CASE statement. It works as expected outside the CASE statement. 


When I use this beast mode: 


LEFT(`Material`, 4)


I get the first 4 characters in the Material column. 


When I use this Beast mode


(CASE when `Process`= 'Lathe' then
/*LEFT(`Material`, 4)*/

I get several items in the column with 'Lathe' 


But when I use this beast mode

(CASE when `Process`= 'Lathe' then
LEFT(`Material`, 4)


I don't get anything in that column


I was careful to pick 'material' from the dataset fields in all cases. 


Any ideas? 

Best Answer

  • MarkSnodgrass
    Answer ✓

    Is there always data in all 3 columns: Process, Lathe, Material? If you aren't seeing the left 4 characters of material when the process column equals the lathe column, I would doublecheck that the material column is populated when the process and lathe columns are the same. 

    To troubleshoot, I would use a table card with those 3 columns in the table and then create a beast mode that says:

    CASE WHEN 'Process' = 'Lathe' THEN 'Y'
    ELSE 'N'

    I would then drag this beast mode into the filters and filter to Y. The table should then show you the values that you would be working with in your earlier beast mode and may shed some light as to what the issue is.

    Another thing to try would be to apply the TRIM and LOWER functions to your evaluation of the process and lathe columns to ensure there isn't spacing or case sensitivity causing issues. You could also apply the TRIM function to the material column before applying the LEFT function.

    Hope this helps. 

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.


  • Thanks so much, you nailed it!  I was missing materials in the material column.  I so appreciate the help. Once you said it, it was obvious what was happening.