Table, compare several monthovermonth
This seems to be similar to the thread located here, but a little more extensive as we're looking to create a table that would compare several months as opposed to just two.
https://dojo.domo.com/t5/CardBuilding/hellohowtocomparemonthtomonthwithsecondaryaxisincard/mp/38214#M5099. And it looks as if a table is/was being planned but don't see that it's launched at this time (https://knowledge.domo.com/Visualize/Adding_Cards_to_Domo/KPI_Cards/Building_Each_Chart_Type/PeriodoverPeriod_Charts)
So, wondering if either of the solutions (beast mode or SQL/ETL) in that thread, or something entirely different, can accommodate MORE than 2 dates in a single row of data to compare several months, showing total discrepancies along with the percentage difference from the previous month. The month over month bar chart doesn't seem to be able to visualize what we need, and hoped maybe it can in a table.
EXAMPLE:
We want to show, from left to right, CURRENT MONTH (December) data w/PRIOR MONTH (November) percentage variance, then November compared to October, & October compared to September. The column to the left would be by company/organization along w/current month, # of discrepancies, & the % change over the previous month. Then it would continue, left to right, for the previous 3 months from the current month.
Can this be done?
Best Answer

Hi, @JohnPeddle,
This should be possible using a method more or less the same as I discussed here: https://dojo.domo.com/t5/CardBuilding/hellohowtocomparemonthtomonthwithsecondaryaxisincard/mp/38214/highlight/false#M5099
For a table card, you need to have a data column for each column to be included in the table. If your dataset already has all the columns you need, then you're all set. However, in your case, seems you don't have all the columns you need in the dataset. Enter the Beast Mode calculation.
You'll need to create a Beast Mode calculation for Month/Year, Discrepancies, and %Difference for each of the four months. That's a total of 12 Beast Mode calculations. The good news is that they'll be nearly the same with just small differences to account for the varying number of months prior.
For example, for the Month/Year calculation for the current month, your calculation will be something like this:
min(
case
when month(`Date`) = month(CURRENT_DATE()) then concat(year(`Date`),'',month(`Date`)
end
)The corresponding calculation for the prior month will look something like this:
min(
case
when month(date_add(`Date`,interval 1 month)) = month(CURRENT_DATE()) then concat(year(`Date`),'',month(`Date`)
end
)and so on for prior months, changing "interval X month" to the appropriate number of months prior to the current month.
The other columns will have very similar logic, but instead of min(), you'll want to use sum() or count() depending on your data structure. Also, for the %Difference, you'll be doing additional math: sum(current month discrepancies) / sum(prior month discrepancies)
Hope that gets you going.
~Dan
1
Answers

Hi, @JohnPeddle,
This should be possible using a method more or less the same as I discussed here: https://dojo.domo.com/t5/CardBuilding/hellohowtocomparemonthtomonthwithsecondaryaxisincard/mp/38214/highlight/false#M5099
For a table card, you need to have a data column for each column to be included in the table. If your dataset already has all the columns you need, then you're all set. However, in your case, seems you don't have all the columns you need in the dataset. Enter the Beast Mode calculation.
You'll need to create a Beast Mode calculation for Month/Year, Discrepancies, and %Difference for each of the four months. That's a total of 12 Beast Mode calculations. The good news is that they'll be nearly the same with just small differences to account for the varying number of months prior.
For example, for the Month/Year calculation for the current month, your calculation will be something like this:
min(
case
when month(`Date`) = month(CURRENT_DATE()) then concat(year(`Date`),'',month(`Date`)
end
)The corresponding calculation for the prior month will look something like this:
min(
case
when month(date_add(`Date`,interval 1 month)) = month(CURRENT_DATE()) then concat(year(`Date`),'',month(`Date`)
end
)and so on for prior months, changing "interval X month" to the appropriate number of months prior to the current month.
The other columns will have very similar logic, but instead of min(), you'll want to use sum() or count() depending on your data structure. Also, for the %Difference, you'll be doing additional math: sum(current month discrepancies) / sum(prior month discrepancies)
Hope that gets you going.
~Dan
1 
Hey @DanB, appreciate the response and details provided; it's more or less what we thought but weren't sure if it was possible due to the number of columns we're looking to compare month over month.
Quick question: looks as if Domo is/was planning a monthovermonth table; would you know if that's forthcoming or has it been scrapped?
Thanks again for your help, pretty sure we can get this completed with your examples! Happy Holidays (Merry Christmas!), and have a great day...
1 
thank you everyone I was able to adapt the suggestion and is working
now I can see if a product shows a big jump in shipped units from one completed month to another
0 
Hey Rodriguez,
Do you mind sharing the code for this table specifically from the 3rd field to the end. Trying to replicate this same table and can use your help. Thanks alot1 
Happy to help
2
Current Month
min(
case
when month(startDate
) = month(CURRENT_DATE()) then concat(year(startDate
),'',month(startDate
))
end
)3
MTD Units
CASE WHEN
MONTH(startDate
)=MONTH(CURDATE()) and YEAR(startDate
)=YEAR(CURDATE()) THENshippedUnits
END4
% Diff (Over Prior Month)
((SUM(
case
when month(startDate
) = month(CURRENT_DATE()) thenshippedUnits
end
)  SUM(
case
when month(date_add(startDate
,interval 1 month)) = month(CURRENT_DATE()) thenshippedUnits
end
))
/
SUM(
case
when month(date_add(startDate
,interval 1 month)) = month(CURRENT_DATE()) thenshippedUnits
end
))5
Last 1 Month
min(
case
when month(date_add(startDate
,interval 1 month)) = month(CURRENT_DATE()) then concat(year(startDate
),'',month(startDate
))
end
)6
Sum Prior Month
sum(
case
when month(date_add(startDate
,interval 1 month)) = month(CURRENT_DATE()) thenshippedUnits
end
)7
% Diff (Last 1/Last 2)
((SUM(
case
when month(date_add(startDate
,interval 1 month)) = month(CURRENT_DATE()) thenshippedUnits
end
)  SUM(
case
when month(date_add(startDate
,interval 2 month)) = month(CURRENT_DATE()) thenshippedUnits
end
))
/
SUM(
case
when month(date_add(startDate
,interval 2 month)) = month(CURRENT_DATE()) thenshippedUnits
end
))8
Last 2 Months
min(
case
when month(date_add(startDate
,interval 2 month)) = month(CURRENT_DATE()) then concat(year(startDate
),'',month(startDate
))
end
)9
Sum 2 Month Ago
sum(
case
when month(date_add(startDate
,interval 2 month)) = month(CURRENT_DATE()) thenshippedUnits
end
)10
% Diff (Last 2/Last 3)
((SUM(
case
when month(date_add(startDate
,interval 2 month)) = month(CURRENT_DATE()) thenshippedUnits
end
)  SUM(
case
when month(date_add(startDate
,interval 3 month)) = month(CURRENT_DATE()) thenshippedUnits
end
))
/
SUM(
case
when month(date_add(startDate
,interval 3 month)) = month(CURRENT_DATE()) thenshippedUnits
end
))hope this helps
0 
this is perfect. thank you so very much!!!
1
Categories
 All Categories
 1.7K Product Ideas
 1.7K Ideas Exchange
 1.5K Connect
 1.2K Connectors
 292 Workbench
 4 Cloud Amplifier
 8 Federated
 2.8K Transform
 95 SQL DataFlows
 602 Datasets
 2.1K Magic ETL
 3.7K Visualize
 2.4K Charting
 691 Beast Mode
 43 App Studio
 39 Variables
 658 Automate
 170 Apps
 441 APIs & Domo Developer
 42 Workflows
 5 DomoAI
 32 Predict
 12 Jupyter Workspaces
 20 R & Python Tiles
 386 Distribute
 111 Domo Everywhere
 269 Scheduled Reports
 6 Software Integrations
 112 Manage
 109 Governance & Security
 8 Domo University
 30 Product Releases
 Community Forums
 39 Getting Started
 29 Community Member Introductions
 98 Community Announcements
 Domo Community Gallery
 4.8K Archive