How many permutations of the string ABCDEFG are there where A is somewhere before B?
$\displaystyle P_{n}=n!$
If A is the first letter you have $\displaystyle P_{6}$ posibilities.
If A is the second letter you have $\displaystyle 5 \cdot P_{5}$ posibilities.
If A is the third letter you have $\displaystyle 4 \cdot P_{5}$ posibilities.
If A is the fourth letter you have $\displaystyle 3 \cdot P_{5}$ posibilities.
If A is the fifth letter you have $\displaystyle 2 \cdot P_{5}$ posibilities.
If A is the sixth letter you have $\displaystyle P_{5}$ posibilities.
If A is the seventh letter you have no posibilities.
So, your answer is $\displaystyle P_{6}+5 \cdot P_{5}+4 \cdot P_{5}+3 \cdot P_{5}+2 \cdot P_{5}+P_{5}=6!+5!(5+4+3+2+1)=5!(6+5+4+3+2+1)=5!\cd ot 21=2520$