Adding filtered count to dynamic text box

I have a dynamic text box that says, in effect, "As of 4/7/2023, there are 75 unhandled service requests." I do this by having as the category a beast mode called "Today", which is simply CURRENT_DATE(), and as value I have "Age", a numeric field showing how long ago, in days, the request was created. I would like to add a second phrase, "of which 45 are older than 5 days". It seems like I would have to somehow filter "Age" inline as one of the %_ values. Is there a way to accomplish this result? Thank you.

Tagged:

Best Answers

  • GrantSmith
    GrantSmith Coach
    edited April 2023 Answer ✓

    Have you tried using a beast mode to calculate the difference between now and 5 days ago and counting them?

    COUNT(CASE WHEN `date_field` < CURRENT_DATE() - INTERVAL 5 DAY THEN `date_field` END)
    

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • MarkSnodgrass
    Answer ✓

    If your data is in 2 rows then you can use the dynamic textbox and use the last and penultimate data to display it like this.

    If your data is all in 1 row then I would suggest using the Multi-Value card under Gauges and you can use the Gauge Value and Target Value. This gauge has quite a few properties and can be configured in a lot of different ways to display the information you want.

    A third option is to use the Textbox card and build all of your dispaly in a beast mode using CONCAT() to combine your text with your data.

    **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.

Answers

  • GrantSmith
    GrantSmith Coach
    edited April 2023 Answer ✓

    Have you tried using a beast mode to calculate the difference between now and 5 days ago and counting them?

    COUNT(CASE WHEN `date_field` < CURRENT_DATE() - INTERVAL 5 DAY THEN `date_field` END)
    

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • MarkSnodgrass
    Answer ✓

    If your data is in 2 rows then you can use the dynamic textbox and use the last and penultimate data to display it like this.

    If your data is all in 1 row then I would suggest using the Multi-Value card under Gauges and you can use the Gauge Value and Target Value. This gauge has quite a few properties and can be configured in a lot of different ways to display the information you want.

    A third option is to use the Textbox card and build all of your dispaly in a beast mode using CONCAT() to combine your text with your data.

    **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.
  • froghunter
    froghunter Member
    edited April 2023

    Thank you both @GrantSmith and @MarkSnodgrass. No, the idea of making a beast mode to produce the entire body of text never occurred to me. I can only plead newbness. For anyone else trying to solve a similar problem, here's what I came up with:

    CONCAT( 'On ',
    CURRENT_DATE(),
    ' there are ',
    COUNT(CASE WHEN active = 'true' THEN active END),
    ' open REQs, ranging from ',
    ROUND(MIN(CASE WHEN active = 'true' THEN Age (Days) END), 1),
    ' to ',
    ROUND(MAX(CASE WHEN active = 'true' THEN Age (Days) END), 1),
    ' days old. Of those, ',
    COUNT(CASE WHEN (Opened At < CURRENT_DATE() - INTERVAL 5 DAY) AND active = 'true' THEN Opened At END),
    ' are > 5 days old.'
    )

    That seems to work as I hoped, give or take some tick marks that got smacked by the forum formatter.