How can I display amounts for different months in a table in Domo?

Options

I want each row to contain the amount for the previous month as well as the amount for each of the 5 months prior to that. What is the best way to do this in Domo with a Table chart type?

Tagged:

Best Answer

  • MarkSnodgrass
    Answer ✓
    Options

    Not quite sure what your data looks like, but

    You can use this to get the prior month

    CASE WHEN LAST_DAY(datefield) = LAST_DAY(DATE_SUB(CURRENT_DATE(), INTERVAL 1 month)) THEN totalamount
    ELSE 0 END

    And this to get the 5 months prior

    CASE WHEN LAST_DAY(datefield) <= LAST_DAY(DATE_SUB(CURRENT_DATE(), INTERVAL 2 month))
    AND LAST_DAY(datefield) >= LAST_DAY(DATE_SUB(CURRENT_DATE(), INTERVAL 6 month))
    THEN totalamount
    ELSE 0 END

    You can drag both of these into your table card and set the aggregation to Sum

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

    You can use the LAG function to calculate prior row values. Here's a previous post I did talking about LAG and doing a rolling average:

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

    Not quite sure what your data looks like, but

    You can use this to get the prior month

    CASE WHEN LAST_DAY(datefield) = LAST_DAY(DATE_SUB(CURRENT_DATE(), INTERVAL 1 month)) THEN totalamount
    ELSE 0 END

    And this to get the 5 months prior

    CASE WHEN LAST_DAY(datefield) <= LAST_DAY(DATE_SUB(CURRENT_DATE(), INTERVAL 2 month))
    AND LAST_DAY(datefield) >= LAST_DAY(DATE_SUB(CURRENT_DATE(), INTERVAL 6 month))
    THEN totalamount
    ELSE 0 END

    You can drag both of these into your table card and set the aggregation to Sum

    **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.
  • BryantCafferty
    Options

    @GrantSmith for the win on speed of reply - awesome! Thanks for jumping on this (my first post to the community forum!).
    Also incredibly fast was @MarkSnodgrass who delivered what I was looking for. Hooray!
    Thanks to you both for helping me out with this one. I'm super impressed with the speed and precision of your replies! 👏