The applysimple/applycomparison functions are used to bypass the mstr sql engine. So you could put your own customised sql in here, you subsitute the names of the microstrategy objects with #0, #1 and so on depending on how many you have.
The mstr knowledge base will help with some of the syntax - TN5200-7X0-0019
Their simple example here is based on a case statement to find low, high & medium values and give a text display for them.
ApplySimple(" CASE WHEN #0 between 0 and 100000 THEN 'Low' WHEN #0 between 100001 and 200000 THEN 'Med' ELSE 'High' END ", Sum([REG_SLS_DLR])
Here #0 is the sum of the REG_SLS_DLR fact to be evaluated in the case statement.