
194 S.W.3d 382 (2006)
Jeff L. DADE, Appellant,
v.
MISSOURI BOARD OF PROBATION AND PAROLE and Missouri Department of Corrections, Respondents.
No. WD 65957.
Missouri Court of Appeals, Western District.
June 27, 2006.
Jeff L. Dade, Charleston, MO, pro se.
Shaun J. Mackelprang, Assistant Attorney General, Jefferson City, MO, for respondents.
Before JOSEPH M. ELLIS, Presiding Judge, HAROLD L. LOWENSTEIN, Judge and PAUL M. SPINDEN, Judge.
*383 JOSEPH M. ELLIS, Judge.
Jeff L. Dade, who appears pro se, appeals the denial, by the Circuit Court of Cole County, of his petition for a writ of mandamus. In his petition, Dade alleged that Respondents (the Missouri Board of Probation and Parole ("Board") and Larry Crawford, the Director of the Missouri Department of Corrections ("DOC")) had improperly applied Missouri law in determining that he had three previous prison commitments and, therefore, was required under section 558.019.2[1] to serve a minimum of eighty percent of his current sentence before becoming eligible for parole, conditional release, or other early release. In particular, Dade requested that the circuit court issue a writ of mandamus commanding Respondents to properly calculate the number of Dade's prior prison commitments (two) and mandatory minimum prison term (fifty percent) in conformance with section 558.019.2.
In his sole point on appeal, Dade argues that the circuit court erred in denying his petition on its merits because the record before the court showed that, under section 558.019.2, he did not have three qualifying previous prison commitments and, therefore, the minimum prison sentence he must serve on his current sentence before becoming eligible for early release was not eighty percent.
On appeal in a mandamus action where the court below denies the petition following answer or motion directed to the merits of the controversy and in doing so determines a question of fact or law, we treat the trial court's judgment as final and appealable and will sustain the judgment unless it is not supported by substantial evidence, is it against the weight of the evidence, or it erroneously applies or declares the law. Wheat v. Mo. Bd. of Prob. & Parole, 932 S.W.2d 835, 838 (Mo.App. W.D.1996); State ex rel. Kessler v. Shay, 820 S.W.2d 311, 313-14 (Mo.App. W.D. 1991). Moreover, our concern on appeal of the denial of a petition for mandamus is whether the trial court reached the correct result, rather than whether the legal reasons the trial court gave in making its decision were themselves correct. State ex rel. Patterson v. Tucker, 519 S.W.2d 22, 24 (Mo.App. S.D.1975).
On October 10, 2000, Dade was arrested for driving while intoxicated ("DWI") and driving with a revoked license. He was charged with those offenses in the same case  namely, Case No. 00CR672578-01. On January 30, 2001, the Circuit Court of Vernon County convicted Dade of felony DWI and driving while revoked, but suspended imposition of sentence as to both offenses. The sentencing court subsequently sentenced Dade to serve a three-year sentence for felony DWI, which was imposed under the 120-day callback program established by section 559.115. DOC received Dade to serve that sentence on April 6, 2001. The sentencing court granted Dade probation in Case No. 00CR672578-01 on July 25, 2001, which was subsequently revoked on August 13, 2002. At this time, Dade was given a concurrent five-year sentence for driving while revoked, and DOC received him to serve that sentence (his latest) on August 20, 2002.
Dade filed his petition for a writ of mandamus on May 3, 2005. Respondents filed an answer and a response in opposition to the petition on July 1, 2005, in which they argued that the petition should be denied because Respondents had correctly calculated both the number of Dade's prior prison commitments and his mandatory minimum prison term. Dade *384 filed a motion for judgment on the pleadings on July 13, 2005, which was followed by his reply to Respondents' answer and response on August 2, 2005. The circuit court dismissed Dade's petition for writ of mandamus on August 18, 2005, issuing an "Order and Judgment" finding that Respondents had correctly determined that Dade had three prior qualifying prison commitments before being received by DOC on his latest conviction and that he was required to serve at least eighty percent of his latest sentence before becoming eligible for early release. This appeal ensued.
The record shows that Dade's commitment history in the DOC is as follows:
DOC received Dade on December 31, 1991, to serve a two-year sentence for tampering in the first degree and a concurrent two-year sentence for leaving the scene of a motor vehicle accident. The concurrent sentences were imposed under the 120-day callback program established by section 559.115, RSMo Cum.Supp.1990. The sentencing court granted Dade probation on both convictions on April 21, 1992, which was subsequently revoked on August 31, 1994.
DOC received Dade on March 3, 1993, to serve a five-year sentence for tampering in the first degree. The sentence was imposed under the 120-day callback program established by section 559.115, RSMo Cum.Supp.1990. The sentencing court granted Dade probation on June 25, 1993, which was subsequently revoked on July 26, 1994.
DOC received Dade on June 6, 1994, to serve a two-year sentence for felony DWI.
DOC received Dade on April 6, 2001, to serve a three-year sentence for felony DWI. The sentence was imposed under the 120-day callback program established by section 559.115. The sentencing court granted Dade probation on July 25, 2001, which was subsequently revoked on August 20, 2002.
DOC received Dade on August 20, 2002, to serve a five-year sentence for driving while revoked. Dade is currently serving this sentence. DOC has determined that Dade must serve at least eighty percent of that sentence before he becomes eligible for early release since he had three qualifying prison commitments before being received by DOC on the underlying felony conviction for driving while revoked, which is his latest offense.
"The office and function of a writ of mandamus is to command the performance of a ministerial act required to be performed under a right established by law." State ex rel. Sch. Dist. of Springfield R-12 v. Wickliffe, 650 S.W.2d 623, 626 (Mo. banc 1983). We agree with the parties that Missouri law charges Respondents with the ministerial duty of determining the number of qualifying prior prison commitments for "any defendant who has pleaded guilty to or has been found guilty of a felony other than a dangerous felony as defined in section 556.061, RSMo., and is committed to the department of corrections," as well as the "minimum prison term" such a defendant "shall be required to serve" before the defendant becomes "eligible for parole, conditional release or other early release by the department of corrections." §§ 558.019.2, 558.019.5.
Section 558.019.2 provides, in relevant part:[2]

*385 Other provisions of the law to the contrary notwithstanding, any defendant who has pleaded guilty to or has been found guilty of a felony other than a dangerous felony as defined in section 556.061, RSMo, and is committed to the department of corrections shall be required to serve the following minimum prison terms:
(1) If the defendant has one previous prison commitment to the department of corrections for a felony offense,[3] the minimum prison term which the defendant must serve shall be forty percent of his sentence or until the defendant attains seventy years of age, and has served at least forty percent of the sentence imposed, whichever occurs first;
(2) If the defendant has two previous prison commitments to the department of corrections for felonies unrelated to the present offense, the minimum prison term which the defendant must serve shall be fifty percent of his sentence or until the defendant attains seventy years of age, and has served at least forty percent of the sentence imposed, whichever occurs first;
(3) If the defendant has three or more previous prison commitments to the department of corrections for felonies unrelated to the present offense, the minimum prison term which the defendant must serve shall be eighty percent of his sentence or until the defendant attains seventy years of age, and has served at least forty percent of the sentence imposed, whichever occurs first.
Under the plain terms of section 558.019.2(3), a defendant is required to serve a minimum prison term of eighty percent of the sentence imposed for his "present offense" only if the State shows that he has "three or more previous prison commitments to the department of corrections for felonies unrelated to the present offense." (Emphasis added). Here, Dade's "present offense" is the felony of driving with a revoked license, for which he was received by DOC on August 20, 2002 to serve a five-year term of imprisonment. Nevertheless, the circuit court counted, as a qualifying previous prison commitment for a felony "unrelated to" that offense, Dade's April 6, 2001 commitment to DOC for felony DWI.
The circuit court ruled as follows:
The Department has properly calculated that petitioner has three commitments. Under § 559.115.7, the [December] 1991 commitments to the 120-day program do not count as prison commitments. However, petitioner was received by the Department in [March] 1993 to serve his five-year tampering first degree sentence, in [June] 1994 to serve his Dade County DWI sentence, and in [April] 2001 to serve his Vernon County DWI sentence. These count as three commitments prior to his receipt to serve the Vernon County driving while revoked sentence in [August] 2002. The Department, having properly determined that petitioner has three prior commitments, is properly requiring petitioner to serve eighty percent of his [five-year] sentence [for driving while revoked] under § 558.019.2. Petitioner's claim therefore fails.
Although he concedes that his March 1993 and June 1994 prison commitments were properly counted against him under section 558.019.2, Dade argues that his April 2001 prison commitment for felony *386 DWI should not have been counted by the court (or by Respondents) as the third qualifying previous prison commitment for his present offense, driving while revoked, because the circuit court erroneously counted, as a qualifying previous prison commitment for a felony "unrelated to" that offense, Dade's April 6, 2001 commitment to DOC for felony DWI. We need not decide this issue, because, as noted supra, our concern in this appeal is whether the circuit court reached the correct result, rather than whether the legal reasons the court gave in making its decision were correct. Therefore, we will affirm if the record shows that the circuit court reached the correct result in denying Dade's petition for a writ of mandamus, even if the supporting legal reasons given by the court were incorrect.
The court found, and all parties to this appeal agree, that "[u]nder § 559.115.7, the [December] 1991 commitments to the 120-day program do not count as prison commitments."[4] While this is true, see Irvin v. Kempker, 152 S.W.3d 358, 362 (Mo.App. W.D.2004), the circuit court and the parties have all overlooked the dispositive fact that on April 21, 1992, the sentencing court granted Dade probation on his 1991 felony conviction for tampering in the first degree, and that this probation was subsequently revoked on August 31, 1994. Since section 559.115.7, RSMo Cum. Supp.2003, only exempts from section 558.019 an offender's first incarceration in a 120-day program "prior to release on probation," it follows that an incarceration following a probation revocation counts as a qualifying prison commitment for purposes of section 558.019.2 even though the corresponding original 120-day callback itself is excluded as such a commitment under section 559.115.7. See Ridinger v. Mo. Bd. of Prob. & Parole, 189 S.W.3d 658, 664 (Mo.App. W.D.2006); Canale v. Dep't of Corr., 194 S.W.3d 364, 366 (Mo. App. W.D., 2006). Accordingly, DOC not only received Dade in March 1993 and June 1994, but also received him to serve his two-year sentence for first degree tampering when his probation on that felony conviction was revoked on August 31, 1994.[5] Therefore, the circuit court properly concluded that Dade had three qualifying prison commitments "prior to his receipt to serve the Vernon County driving while revoked sentence in [August] 2002."
Accordingly, the judgment of the circuit court denying Dade's petition for a writ of mandamus is affirmed.
All concur.
NOTES
[1]  Unless stated otherwise, all statutory references are to RSMo 2000.
[2]  Although the relevant portions of section 558.019 were amended in 2003, the version of section 558.019 in effect on October 10, 2000 (i.e., the one contained in RSMo 2000) is controlling because that is the date of the last offense committed by Dade. See Irvin v. Mo. Bd. of Prob. & Parole, 34 S.W.3d 202, 206 (Mo.App. W.D.2000).
[3]  As used in section 558.019, the term "`prison commitment' means the receipt by the department of corrections of a defendant after sentencing." § 558.019.2.
[4]  "An offender's first incarceration for one hundred twenty days for participation in a department of corrections program prior to release on probation shall not be considered a previous prison commitment for the purpose of determining a minimum prison term under the provisions of section 558.019, RSMo." § 559.115.7, RSMo Cum.Supp.2003 (emphasis added).
[5]  For purposes of counting the number of qualifying prison commitments under section 558.019.2, the fact that Dade was already in prison serving a separate sentence at this time is irrelevant. Ridinger, 189 S.W.3d at 666.
