Adding a MOM or YOY value in top of card

Is there a way to incorporate MOM or YOY comparisons within cards? Similar to the visual below (which is in Power BI)?


Answers

  • GrantSmith
    GrantSmith Indiana 🥷

    Hi @NathanDorsch

    I'd recommend restructuring your data to have multiple different periods in the same graph. I've done a write up in the past on how to accomplish this here: https://dojo.domo.com/discussion/53481/a-more-flexible-way-to-do-period-over-period-comparisons#latest



    **Was this post helpful? Click Agree or Like below**

    **Did this solve your problem? Accept it as a solution!**
  • Thank you. Can you share a screenshot of what this would look like on a card/dashbaord?

  • MarkSnodgrass
    MarkSnodgrass Portland, Oregon 🥷

    You can use the summary number field to display this information. Read this post here on how to do the directional arrows, specifically cwolman's post on June 2019.

    https://dojo.domo.com/discussion/42497/summary-number-conditional-format-colors-with-directional-arrow#latest

    Alternatively, you can build a dashboard and use the multi-value gauge and lay them out in an order similar to your screenshot. If all the cards are built off the same dataset, they will filter the same when page filters or other filters are applied.

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • @MarkSnodgrass I think I got this figured out for the most part, but am currently hung up on the initial value... I'd like the summary to say 1,319,412 [arrow] -1% [arrow] -2% MOM. However, Domo is separating the value and the follow on YOY/MOM indicators... How do I get them on one line? And how can I have value format have commas so it is 1,319,412 instead of 1319412? Below is a screenshot and the Beastmode calculation I have...


    Concat(

    '<div style="font-size:15px">',

     CONCAT(sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end), case when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))) > 0 then '<div style="color: green">'

        when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))) < 0 then '<div style="color: red">'

        else '<div style="color: black">' end,

       case when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))) < 0 then '&#8681; '

        when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))) > 0 then '&#8679; '

        else ' ' end, round(((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -2 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end)))*100,0), '%', ' YOY  ', case when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -2 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -2 then `Sessions` end))) < 0 then '&#8681; '

        when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -2 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -2 then `Sessions` end))) > 0 then '&#8679; '

        else ' ' end, round(((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -2 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -2 then `Sessions` end)))*100,0), '%', ' MOM'))

        

  • MarkSnodgrass
    MarkSnodgrass Portland, Oregon 🥷

    @NathanDorsch The div tags cause them to be on separate lines. I haven't played around with formatting it like you want too much, but you could try div style="float:left" for your first div and div style="float:right" for your 2nd div. Here's a link to more info on the css style.

    https://www.w3schools.com/css/css_float.asp

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • @MarkSnodgrass or @GrantSmith or anyone who can help.... I have spent several hours working on this and cannot figure this out! I couldn't seem to get the div style="float:left" working... then I tried '<div align=left>' and right... to no avail

    What am I doing wrong? There's got to be a way to do this... :-(

    Below is my current beastmode calc

    Concat(

    -- Size 15px

     '<div style="font-size:15px">',

    -- Color green YOY and up arrow

     CONCAT( '<div align=left>', case when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -3 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))) > 0 then '<div style="color: green">''&#8679; '

    -- color red YOY and down arrow

         when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -3 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))) < 0 then '<div style="color: red">''&#8681; '

    -- color black YOY and no arrow

         else '<div style="color: black">' end,

    -- Value YOY

         round(((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -3 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -4 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end)))*100,0), '%', ' YOY  ',

    -- Green arrow MOM and up arrow

         CONCAT('<div align=right>', case when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -3 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -4 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -4 then `Sessions` end))) > 0 then '<div style="color: green">''&#8679; '

    -- color red MOM and down arrow

         when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -3 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -4 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -4 then `Sessions` end))) < 0 then '<div style="color: red">''&#8681; '

    -- color black MOM and no arrow

         else '<div style="color: black">' end,

    -- Value MOM 

        round(((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -3 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -4 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -4 then `Sessions` end)))*100,0), '%', ' MOM')))

        

  • @MarkSnodgrass I think I got this figured out for the most part, but am currently hung up on the initial value... I'd like the summary to say 1,319,412 [arrow] -1% [arrow] -2% MOM. However, Domo is separating the value and the follow on YOY/MOM indicators... How do I get them on one line? And how can I have value format have commas so it is 1,319,412 instead of 1319412? Below is a screenshot and the Beastmode calculation I have...


    Concat(

    '<div style="font-size:15px">',

     CONCAT(sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end), case when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))) > 0 then '<div style="color: green">'

        when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))) < 0 then '<div style="color: red">'

        else '<div style="color: black">' end,

       case when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))) < 0 then '&#8681; '

        when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end))) > 0 then '&#8679; '

        else ' ' end, round(((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -2 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -13 then `Sessions` end)))*100,0), '%', ' YOY  ', case when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -2 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -2 then `Sessions` end))) < 0 then '&#8681; '

        when ((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -2 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -2 then `Sessions` end))) > 0 then '&#8679; '

        else ' ' end, round(((sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -1 then `Sessions` end) - sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -2 then `Sessions` end))

        / (sum(case when PERIOD_DIFF(date_format(`Date`,'%Y%m'),date_format(now(),'%Y%m')) = -2 then `Sessions` end)))*100,0), '%', ' MOM'))