Best Of
Re: Smarttext showing actual dates used
@Jones01 Do you have this box checked in your card? I believe the date must be visible in order to be affected by the global date filter.
Re: Smarttext showing actual dates used
@Jones01 You can customize your summary number by wrapping it in a CONCAT() function like the examples in this article: https://domohelp.domo.com/hc/en-us/articles/360043430093-Sample-Beast-Mode-Calculations-Card-Element-Transforms#4.
Here is an example of what that could look like:
CONCAT(DATE_FORMAT(MIN(`Date`),'%m/%d/%y'),' - ',DATE_FORMAT(MAX(`Date`),'%m/%d/%y'))
Re: Can this be built with a card and beast mode without pre aggregating
I'm not sure what chart type you are using, but I believe I was able to do this with three beastmodes. One to get the name of the day and another to capture the hour from your datetime field.
HOUR:
HOUR(`DateField`)
Week Day:
DAYNAME(`DateField`)
Avg Total Count:
AVG(SUM(`Count`)) FIXED (BY day(`DateField`))
You can then see the average total for any day of the week. You can also filter to only include certain hours or only values between certain dates.
Re: Calculating Summary Level Average of a Calculated Field
@RanjitR - you could always try the new FIXED function in beastmodes now.
AVG(SUM(`CY_TRANSACTION`) / COUNT(DISTINCT `STORE_ID`)) FIXED (BY `YEAR_PERIOD_WEEK`)
Re: Using ETL formula for finding between dates
You can do some simple date manipulation to get the Monday of the current week with a Formula Tile
`Date` - INTERVAL (CASE WHEN DAYOFWEEK(`Date`) = 1 THEN 6 ELSE (DAYOFWEEK(`Date`) - 2) END) DAY
DAYOFWEEK returns a number between 1 (Sunday) and 7 (Saturday).
The CASE statement is checking if it's a Sunday to subtract 6 days instead of 1.
-2 is to reduce the days to subtract to get to Monday. For example Tuesday (3) we need to subtract only 1 day instead of 3 days.
You can then tie it all together with a CONCAT function and a DATE_FORMAT:
CONCAT('Week of ', DATE_FORMAT(`Date` - INTERVAL (CASE WHEN DAYOFWEEK(`Date`) = 1 THEN 6 ELSE (DAYOFWEEK(`Date`) - 2) END) DAY, '%m/%d'))
Re: coalescing data in a table
You need to put your condition inside your aggregation.
SUM(CASE WHEN `Order Src` LIKE 'CSR' THEN `order_line_total_price`) END)
Also - as a side note your LIKE 'CSR' isn't matching on any wild cards so it's expecting Order Src to be equal to exactly CSR. if you're wanting to see if CSR is anywhere inside the Order Src value then you'd need to put in the wildcards
LIKE '%CSR%'
You'll also need to make sure you aggregate the other columns you wish to summarize for each account
Re: Beast Mode for Sum Function
@ozarkram You cannot have multiple fields inside the same SUM() function. Try changing to this:
CASE WHEN YEAR(`DATE`) = year(CURRENT_DATE()) THEN `CURRENT_INVENTORY` + `NONCURRENT_INVENTORY` + `OLD_INVENTORY` END
Re: Beast Mode for Sum Function
SUM only takes a single argument. You'll need to add them together. Note that I'm adding 3 sums together as it will handle nulls otherwise if I add CURRENT_INVENTORY + NONCURRENT_INVENTORY + OLD_INVENTORY and if any one of those values is null then the entire value will be null causing incorrect summations.
SUM(CASE WHEN YEAR(`DATE`) = year(CURRENT_DATE()) THEN `CURRENT_INVENTORY` ELSE 0 END) + SUM(CASE WHEN YEAR(`DATE`) = year(CURRENT_DATE()) THEN `NONCURRENT_INVENTORY` ELSE 0 END) + SUM(CASE WHEN YEAR(`DATE`) = year(CURRENT_DATE()) THEN `OLD_INVENTORY` ELSE 0 END)
Re: How do beastmodes handle filter context?
@MichelleH Ok this is helpful, so it applies the filter first (even within a card) then calculates the BM. @RobSomers , sure the one I have to hand is this SUM(Implementing) BM:
The dataset has Distinct IDs . 'Implementing' is a Measure field showing the hours each ID has spent against the Implementing status. The 'Status Name' column is the current Status of the ID which has been filtered to Status = Implementing. (Context: IDs can have values in the 'Implementing' Measure but have Staus Name <> Implementing)
My expectation here would be that SUM(Implementing) would show the same values as the Implementing Measure. This is the case when I add the ID into the table (far right) it displays as expected:
If I remove the Status = Implementing filter from the card - and remove the ID from the table - it will show as the first picture.
Re: Beast Mode to remove text after space
@ozarkram you can do this using the instr() and left() functions. You use instr() to find the first space, and then use left to take everything to the left of that index.
The formula looks like this:
left(fieldname,INSTR(fieldname,' ')-1)
mhouston






