We do this by first forecasting the number of person-hours it would take to build the system. Then we put a certain monetary value to these person-hours, which is usually the average salary of the software engineers that will be hired to build the system plus a little overhead. We then put all the other necessary materials to finish the system such as cost of servers, peripherals, etc.
We then estimate the yearly cost of maintaining the system, which we usually approximate at 20% of the initial build cost. After which we pick a discounting rate ranging from 8% to 12% (10% is usually the sweet spot), and do a Net Present Value (NPV) calculation of the Total Cost of Ownership (TCO) of the system from year 0 (today) to year 4. We top it off by adding another 10%-20% contingency reserve margin to cover for ‘other unseen costs’.
After doing all that, we go window-shopping. We go through a list of cloud-based solutions and ask them for their subscription costs. We compare the yearly subscription cost for cloud-based solution A, B, C…. and the cost of building the system. Finally, we are ready to make a decision: do we develop our own custom application, or do we lease or subscribe to Software as a Service (SAAS) solutions?
If this is how you do decision analyses, I encourage you to look at the past 5-10 build-or-buy decisions you made. You will find yourself that often you decided to build the application either in-house; or, using outsourced development partners. Rarely (perhaps 10% or even less probability), have you decide in favor of cloud-based solutions.