We use partitions and the number of linear extensions of a given poset in order to obtain formulas for the number of some restricted higher dimensional compositions of a positive integer.