It’s a common misconception that “demandbased” pricing means the higher the sales of something, the higher the price should be. But the optimal price is not always correlated with demand, at least not in the way you might think.
To start with, “demand” is not something that can be measured as a single value. Demand is a mathematical function that maps prices to quantities sold at those prices when all other demand factors are taken into consideration. The number of units of product sold isn’t, by itself, a complete picture of demand. At best, quantity sold is only evidence of demand at a particular price, but it isn’t even always that. If a product sells out, there may have been even more demand in the market than can be discerned from sales, because the sales were constrained by a limited supply. In that case, using sales as a measure of actual demand may be very misleading.
Consider the following examples of demandbased pricing where optimal price is not necessarily correlated with demand in the way you might think:

Suppose there are five consumers in a market: A, B, C, D, and E, and suppose their personal valuations of a ticket to their local theme park are $10, $20, $30, $40, and $50, respectively. Let’s further assume that there is unlimited availability of tickets (no supply constraints), and that the only alternative to going to the theme park is staying at home). What is the optimal price? If the park charges $10, all five of A, B, C, D, and E will purchase, and total revenue will be 5 x $10 = $50. If the park charges $20, everyone except A will purchase, and total revenue will be 4 x $20 = $80, and so on. The optimal price will be $30 because it will generate 3 x $30 = $90 in total.
Now, instead of A, B, C, D, and E each representing one consumer, let’s assume that each represents 100 consumers. Believe it or not, the optimal price will still be $30. Therefore, “demand going up” for a product—in the sense of more people willing to purchase it—does not necessarily mean that the optimal price will change. This is illustrated in the following figure, where P is price and Q is quantity, and the labels Q* and Q** represent the original (5) and increased (100) numbers of consumers.

In the previous example, we see that the optimal price under demandbased pricing is in fact about the composition of consumers in the market. If the composition does not change, optimal price will be the same (i.e., P* = P**) even with more consumers.
Extending our example above, let’s say that on Mondays only consumer types A, B, and C show up; that consumers do not treat Monday and Sunday as alternatives; and that each consumer type’s valuation is the same for Monday. In that case, then the park should charge $20 on Monday, because 200 x $20 is more than either 100 x $30 or 300 x $10. But, on Sundays, if all five types of consumer show up, the optimal price is $30 as explained above.

Lastly, let’s look at how a change in the composition of the market affect demandbased pricing. If the proportions of consumers in the market of types A, B, C, D, and E are not equal, but instead we add more consumers of types A and B, then this increase in “demand” actually leads to the optimal price P** being lower rather than higher than the original price P*:
Since we cannot observe each person’s valuation directly, the best approach is to estimate the composition of purchasers in the market based on the historical data, and to determine from these estimates what to charge on each day. Therefore, “price elasticity of demand”, which measures the % change in quantity sold as a result of a small change in price, becomes a more critical measure than the observed level of sales.
Many people assume that demandbased pricing is merely raising prices in response to increases in the number of purchasers. But figuring out the optimal price actually requires indepth analysis of sales data to learn which price changes will affect which consumers’ behaviors in what ways.