Getting value of previous quarter and comparison
Hello Team,
I have a date column named 'Fiscal quarter start date' and another Beast mode with calculated value for 'Customer Survey'
I want to create a beast mode in which I will compare the Customer survey of the Current Quarter with the second last quarter. I tried to create a Case statement but unable to get results card is not loading any results. Please help
Best Answers

@MayaU_01  I think you should look at my response to another recent question.
I showed the way I like to do what I refer to as trends. Comparing year to previous year and the year before that. I use the same calculation formula to compare previous quarters across multiple years.Using this calculation, add another line that says:
and QUARTER('date') < = QUARTER(CURRENT_DATE())
And you will have a comparison of quarter to previous quarter. And quarters of the year to quarters of previous years.
What I don't show on that other thread is that I use a similar formula to then represent the difference or delta between them. Take the result of one quarter and subtract from the next and you get the difference. Take that difference over the previous total and you get the percentage of increase or decrease relative to the previous quarters.This then lets me setup a table view or a bar chart, line chart, etc….with comparisons next to each other. When I take the above formula for difference and put it over the previous total, I get the percentage of increase or decrease.
.25 or 25% means a growth over the previous period of 25%.
Then I set up a table chart that has columns for
PY QTD {whatevers}  CY QTD {whatevers}  CY QTD Difference  CY QTD % of Change  etc.
Here's the other thread…** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **1 
Agree with @ArborRose, you'll need Beast Modes for each quarter and then compare between them. Just be aware that the
QUARTER
formula will work for the Gregorian Calendar, if you need to use a fiscal calendar that does not goes from January → December, then you'll need to adjust to account for that.0
Answers

Whenever I'm doing Period over Period analysis I will structure my data with my own custom date dimension dataset. You can then define how the offsets are and allows you to more easily filter your datasets so that you can look at this quarter but also have records for last quarter.
I've done a write up on this approach here:
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 
You would want to use the Lag Windows Function in order to get the previous value.
 LAG(SUM(`surveyvalue`)) OVER (ORDER BY `fiscalquarterdate`)
It's also worth pointing out that the Flex Table card is a great card for showing a previous value next to a current value. It's highly configurable to show a combination of values, bar graphs, percent changes and directional indicators. Here is the KB article:
https://domosupport.domo.com/s/article/360043429073?language=en_US
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 
Hi,
I have used this method of LAG, but using this i am getting value of previous quarter in this quarter which is i think is the task of this function.
I may have explained the question wrong.I thought to use that value but it will not help.
My question is  I have columns, Client, Mydate column, Survey Value (A Beast mode).
I am making a table view  with client in first column then add last 4 quarters of Survey value in the next 4 columns and then make a last column in which I am writing a beast mode which is  If the current quarter survey value is greater than survey value of second last quarter then 'Good' If decreased then 'BAd' If same then 'Same' If there is value in last quarter but no value in this quarter then 'No response'
CASE WHEN
Survey
> LAG (Survey
, 2 ) OVER (ORDER BYFiscal Quarter Start Date
) THEN 'Increased'Survey
< LAG(Survey
,2) OVER (ORDER BYFiscal Quarter Start Date
) THEN 'Decreased'
Else 'Same'
ENDthis beast mode is not helping and I am unsure that what else can help me.
0 
@MayaU_01  I think you should look at my response to another recent question.
I showed the way I like to do what I refer to as trends. Comparing year to previous year and the year before that. I use the same calculation formula to compare previous quarters across multiple years.Using this calculation, add another line that says:
and QUARTER('date') < = QUARTER(CURRENT_DATE())
And you will have a comparison of quarter to previous quarter. And quarters of the year to quarters of previous years.
What I don't show on that other thread is that I use a similar formula to then represent the difference or delta between them. Take the result of one quarter and subtract from the next and you get the difference. Take that difference over the previous total and you get the percentage of increase or decrease relative to the previous quarters.This then lets me setup a table view or a bar chart, line chart, etc….with comparisons next to each other. When I take the above formula for difference and put it over the previous total, I get the percentage of increase or decrease.
.25 or 25% means a growth over the previous period of 25%.
Then I set up a table chart that has columns for
PY QTD {whatevers}  CY QTD {whatevers}  CY QTD Difference  CY QTD % of Change  etc.
Here's the other thread…** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **1 
Agree with @ArborRose, you'll need Beast Modes for each quarter and then compare between them. Just be aware that the
QUARTER
formula will work for the Gregorian Calendar, if you need to use a fiscal calendar that does not goes from January → December, then you'll need to adjust to account for that.0
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
 697 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
 113 Manage
 110 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