What determines melee damage?

Solution 1:

According to the dragonage wikia this is the damage calculation process:

 Base Weapon Damage (in the weapon description, not including on-hit bonuses)
 + Primary Attribute Modifier (0.5 per point over 10)
 * Ability Damage Factor (Winter's Grasp is 4.48833 for example)
 * Hit Result Modifier (1.0 for normal hits, 1.5+ for critical hits)
 + Berserk Bonus Damage
 * Damage Type Modifier (stuff like +15% fire damage)
 * Blood Frenzy/Veneer of Calm Modifier (1.0-2.0)
 * Cross class Combo Multiplier (if applicable)

That's after a hit has been registered. Whether you hit or not appears to depend solely on abilities, not range:

StatLevel = (Attribute - 10) / ScalingCoefficient
StatValue1 = PropertyData(INTEGER_PART(StatLevel))
StatValue2 = PropertyData(INTEGER_PART(StatLevel) + 1)
StatValue = StatValue1 + FRACTIONAL_PART(StatLevel) x (StatValue2 - StatValue1)

And the attribute for rogue is dex. Scaling coefficient is 1.0 for defense, 1.25 for attack.

Solution 2:

If you can use the bow in close quarters, it deals bow damage. It's based on class and weapon type and weapon level and attribute. That's it, excepting other bonus damage properties like fire berserk etc.

If you are asking what happens when you switch to twin dagggers, you then switch two weapon damage.

This chart may help: chart - click me.