Meaning of dimension in dimensional analysis I was wondering what dimension can mean in physics?
I know it can mean the dimension of the space and time.
But there is dimensional analysis. How is this dimension related to and different from the previous one? How is it related to and different from units (e.g. kilometer)?
 A: A dimension (in dimensional analysis) is defined by the transformation law of an object under changes in scale. If I have an object which is twice as big, it has 4 times the surface area and 8 times the volume, so the surface area has dimension of length-squared, and the volume has dimension of length-cubed. Dimensional analysis is applied whenever you have a quantity where there is a scale that you can change.
There are two different notions of dimension of space which took a while to be disentangled. The topological dimension is defined inductively by the cutting properties of the space. If a space can be cut in two by a point, it's 1 dimensional. If it can be cut in two by a 1 dimensional shape, it's two dimensional. This type of definition requires care for wild shapes, but it produces an integer dimension of the space.
The scaling dimension, or fractal dimension, is defined differently, in terms of distances on the space. The scaling dimension counts the number of boxes of size A required to cover the space, and sees how this goes up as A gets small. The exponent is the scaling dimension.
A: A dimension, as used in physics and engineering, is often used to describe a unique, well-defined attribute to which a quantitative value or function can (at least theoretically) be assigned.  Specifically, as described below by the BIPM, this attribute must be able to be described/used within a system of non-contradictory equations relating the relevant system of quantities.
I apologize in advance for the wishy-washiness of this definition, but it is the best that I can come up with.  I highly recommend reading section 1.3 of The SI Brochure.  It might also help to read an IT perspective like this section on n-dimensional arrays in Numpy.
Dimensions in common parlance refer only to spatial dimensions (and sometimes time) but practically any attribute can be called a dimension depending on the circumstance. Forthermore, the properties of dimensions that are familiar in the spatial case can often be extended to other situations.
For example, if two dimensions are orthogonal, it means that one cannot be described, even in part, by reference to the other.  A vector on the xy-plane, for example, can be described in terms of $\hat x$ and $\hat y$; but $\hat x$ and $\hat y$ cannot be described in terms of eachother.  This concept is often extended in fields such as quantum mechanics where wave functions can be treated like dimensions and tested for orthogonality.

*edit
I should have included it origianally, but a good source for definitions used in science and engineering is the International Vocabulary of Metrology (VIM).  According to this source:

1.7 (1.5)
quantity dimension
dimension of a quantity dimension
expression of the dependence of a quantity on the base quantities of a system of quantities as a product of powers of factors corresponding to the base quantities, omitting any numerical factor

where a "system of quantities" is defined as

1.3 (1.2)
system of quantities
set of quantities together with a set of noncontradictory equations relating those quantities

Clearly the definition of "dimension" (as I understand your question to mean it) is quite broad and might more properly be referred to as "base quantity."

1.4 (1.3)
base quantity
quantity in a conventionally chosen subset of a given system of quantities, where no subset quantity can be expressed in terms of the others

A: Can't help adding a reference to the notion of fractal dimension
A: Tim, you are obviously referring to metrological dimensions. Let's start with some fundamental definition:
Def: a physical property that can be quantified is called a "physical quantity" or just "quantity". 
Examples of quantities are: the mass of Tim, the height of the Eiffel tower, the time it takes the earth for a full rotation, the length of a foot.
Most of these quantities cannot be compared, because they are of a different kind. 
Only the height of the Eiffel tower and the length of a foot can be compared, because they are quantities of the same kind. It is perfectly sensible to say "the length of the Eiffel tower is 984 times larger than a foot". It is not sensible to say "the mass of Tim is equal to the height of the Eiffel tower", because these quantities are not of the same kind.
Hence, there are different kind of quantity, like for example: time, length, speed, acceleration, force, power, energy, etc. There are many more. Each type is assigned a dimension.
It turns out, that these different quantity types are not all independent of each other. For example the quantity type speed can be seen as a being derived from the quantity length and the quantity time. We say: the dimension of the quantity speed is equal to dimension of the quantity length divided by the dimension of the quantity time.
Note that this definition of dimension is not analogous to the definition in geometry. 
In geometry the dimension of a space is equal to the number of independent vectors. 
In metrology, there are believed to be 7 base quantities (there is no consensus on this) but there are many more dimensions. 
