Compute expression is the most powerful tool which allows you to add additional fields, additional derived fields into the dataset without changing/altering the source data.

In this blog, we are going to sort the stages based on our business need instead of using the standard sort order which does follow the alphabet order.

Below is the image before sorting the stage values

We wanted to sort the Stages like below

To Achieve this, we are going to use compute expression while preparing the dataset inside the Dataflow

We are using Case statement here to check the stage name values and then assigning the new value for the sage. Below is the formula

case
when 'Opp.StageName' == "Id. Decision Makers" then "[1] Id. Decision Makers"
when 'Opp.StageName' == "Value Proposition" then "[2] Value Proposition"
when 'Opp.StageName' == "Prospecting" then "[3] Prospecting"
when 'Opp.StageName' == "Qualification" then "[4] Qualification"
when 'Opp.StageName' == "Needs Analysis" then "[5] Needs Analysis"
when 'Opp.StageName' == "Negotiation/Review" then "[6] Negotiation/Review"
when 'Opp.StageName' == "Perception Analysis" then "[7] Perception Analysis"
when 'Opp.StageName' == "Proposal/Price Quote" then "[8] Proposal/Price Quote"
when 'Opp.StageName' == "Closed Won" then "[9] Closed Won"
else "[9] Closed Lost"
end

Note: – We have used # because # will give us the stages in the orders.

Follow this link to lear more about Compute Expression

Check out the below link for more scenarios where you can use Compute Expression.

Keep Learning & Keep Sharing

#SharingIsCaring #AskPanther

Resources

2 thoughts on “Compute Expression in Einstein Analytics”

  1. How can we add a sliding function inside compute expression. I mean, can we put a saql expression inside it? is there any alternate way? I need to automate the dataset to bring out the quaterly rolling average.

    1. Hi Jeet,

      Sorry for the late response. I am not 100% sure about this but I believe we can use some SAQL function in compute expression as in my project we have used case statements and many more.

      You can give it a try and then if there is any problem, we can solve it together.

      Thanks & Regards,
      SFDCPanther

Leave a Reply