• Arjun Patel 16
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I edited SAQL to show month name instead of number in a dashboard step, using a case statement. The steps groups case records by Created Month and limits the data to cases created last and current month. The month name now shows up as expected (e.g., "December" instead of "12"), but the toggle using the step doesn’t facet properly. I am not a developer, and put together the case statement based on examples I found on the internet. I am clearly missing something, and I don’t understand every piece of code I have, so troubleshooting has been very much trial and error, but now I ran out of options.

Here is the code from an out-of the box step that shows month numbers and that works properly:
 
q = load "ServiceCase";
q = filter q by date('CreatedDate_Year', 'CreatedDate_Month', 'CreatedDate_Day') in ["1 month ago".."current month"];
q = group q by 'CreatedDate_Month';
q = foreach q generate 'CreatedDate_Month' as 'CreatedDate_Month', count() as 'count';
q = order q by 'count' desc;
q = limit q 2000;

Here is my code that shows month names and doesn’t facet properly:
q = load "ServiceCase";
q = filter q by date('CreatedDate_Year', 'CreatedDate_Month', 'CreatedDate_Day') in ["1 month ago".."current month"];
q = group q by 'CreatedDate_Month';
q = foreach q generate (case when 'CreatedDate_Month' in ["01"] then "January" when 'CreatedDate_Month' in ["02"] then "February" when 'CreatedDate_Month' in ["03"] then "March" when 'CreatedDate_Month' in ["04"] then "April" when 'CreatedDate_Month' in ["05"] then "May" when 'CreatedDate_Month' in ["06"] then "June" when 'CreatedDate_Month' in ["07"] then "July" when 'CreatedDate_Month' in ["08"] then "August" when 'CreatedDate_Month' in ["09"] then "September" when 'CreatedDate_Month' in ["10"] then "October" when 'CreatedDate_Month' in ["11"] then "November" when 'CreatedDate_Month' in ["12"] then "December" else "N/A" end) as 'CreatedDate_Month', count() as 'count';
q = order q by 'count' desc;
q = limit q 2000;

And by "it doesn't facet properly," I mean that when I click on the month name in the toggle, all widgets display the "No reults found" message. When I click on the same month name again, it does the same as the "Reset" feature, i.e., returts all widgets into their default position. When I click on the same month name the thrid time, I get the "No reults found" message again, etc.

Could someone please help me understand what I am doing wrong? Any help would be greatly appreciated. Thank you so very much in advance!