Comparing Month and Year Data using Beast Modes
Problem Statement: It is critical to be capable to compare a person thirty day period or calendar year to an additional and make sure that they are equivalent. This requires us to both hide the present-day thirty day period from a card because it is not full, or demonstrate the action in just about every thirty day period by means of the same place in time. For instance, if it is the 15th of the thirty day period, just show the initial 15 days of action in each and every thirty day period. We didn’t want to manually alter cards every single month or have to reveal why a month appears to be so different from a different thirty day period. Alternative Statement: I was in a position to fix this challenge by creating two distinctive beast modes for the two unique predicaments. If I want to exclude the current month from a card, I produce a beast mode that seems at the day in the dataset and checks to see if it is less than or equal to the very last day of the present date’s earlier month. If it is, then I assign it a price of “include”, usually I assign it a benefit of “exclude”. I set this beast method in my filter and filter to include things like. Here is the beast mode: Beast Mode for such as finished months Situation WHEN `EntryDate` <= LAST_DAY(DATE_SUB(CURRENT_DATE(), interval 1 MONTH)) THEN ‘Include’ ELSE ‘Exclude’ END If I want to only show activity through the same point in time each month, I utilize the DAYOFMONTH function to evaluate whether the day is less than or equal to today’s day. I then include or exclude and drag it into the filter just like my other beast mode. This allows us to see how the current month is trending compared to the same point in time as previous months. Here is the beast mode: Beast Mode for including only up to the same point in time of each month CASE WHEN DAYOFMONTH(`EntryDate`) <= DAYOFMONTH(CURRENT_DATE()) THEN ‘Include’ ELSE ‘Exclude’ END Demo: I created a video that demonstrates how to use each function: