Some people have a minhag to fast on a yahrtzeit (see Shulchan Aruch OC 567,7-9). If the day of the yahrtzeit occurs on a public fast day such as 17 Tamuz, can the fasting done then count for the yahrtzeit fasting or does a separate day need to be done for the yahrtzeit?
The Gemora Shavuos 20a-b says that one can make a Neder not to eat on the fast of Geddalia in spite of the fact that it is already forbidden to eat miderabanan:
איזה איסר האמור בתורה האומר הרי עלי שלא אוכל בשר ושלא אשתה יין כיום שמת בו אביו כיום שמת בו פלוני כיום שנהרג בו גדליה בן אחיקם....
כיום שנהרג בו גדליה בן אחיקם איצטריך ליה סלקא דעתך אמינא כיון דכי לא נדר נמי אסור כי נדר נמי לא הויא עליה איסור והאי לאו מיתפיס בנדר הוא קמ"ל
Fasting on a Yortzeit is also binding through a neder as indicated in the Gemara above, so since one can make a Neder that is binding not to eat on the fast of Gedallia (or any rabinical fast day), so too a Yortzeit fast can coincide with a fast day.
In fact Rashi there explains:
הנדרים חלים על דבר מצוה כדבר הרשות: Nedarim are binding on a Mitzva from the Torah which would imply even on Yom Kippur if one made a Neder to fast he would have fulfilled his Neder.
But Tosfos there argues:
אם נדר לקיים מצוה כגון שאמר קונם שלא אוכל ביוה"כ אין איסור חל על איסור ולהכי איצטריך טעמא דמדרבנן one cannot make an Issur (Neder not to eat) on a pre-existing Issur from the Torah (Yom Kippur where it is forbidden to eat), rather one can only make a Neder on a Rabbinic Prohibition.
It is considered a mitzvah to fast on the day one's father or mother died. - Rema; Shulchan Aruch Yoreh Deah 376:4 (376:5 in some books)(See also Yoreh Deah 402:12; Rema again.) The anniversary of death is called "Yahrtzeit" in Yiddish. (Literally translated: "Year's time")
I only found one source (one opinion) which directly answers this question. Therefore, I believe it is valuable to examine what the Sefarim say about a parent's Yahrtzeit so we can reach a proper analysis of the issue and come to our own answer. The following is my analysis, with the one source in bold:
In order to answer the OP's question, we need to understand why one should fast on a Yahrtzeit for a parent.
The Sefer Tanya (in Igeres HaTeshuva) discusses the Torah reason behind fasting in general.
1) By fasting one burns up some of their fat and blood as a gift to Hashem (like offering an animal upon the altar whose main gifts were burning the fat and offering blood).
2) By fasting, one removes themselves from the material world and is able to focus on Hashem in humility and a spirit of repentance taken seriously. This will cause a person to change their deeds for the better etc.
(The Tanya informs us that #2 is the main concept.)
Now if the reason one fasts on a parent's Yahrtzeit, is similar to #1 above, then we could possibly think that one should fast on a different day than a public fast day. How can one use the offering meant for one payment (the public fast) for another payment (the soul of one's parent) ?
But, if the reason for fasting over a parent is to encourage a person to repent, (#2 above) thereby causing honor to the parent in Heaven; (Look how the child of this person is now doing a mitzvah...let Heaven ascribe the merit of the child's repentance upon the soul of the deceased.) then it does not matter if the fast coincides with an already established public fast, because the result is the same; namely that the child will repent!
The Sefer Chassidim (231; 232) gives two reasons for fasting on a parent's Yahrtzeit.
1) Respect for the parent so the child's deeds on that day provide an atonement for the parent's soul (since the day of death is a spiritual time of judgment for the soul in Heaven).
2) Since this anniversary day is so tragic for that child, they need extra protection provided by the spiritual merit of fasting on that day.
The Levush also brings these two reasons.
But, both reasons are equally addressed even if one fasts for a parent on an already public fast day.
The poskim do address the case of a Yahrtzeit falling on a positive day like Shabbos; in which the fast is either pushed off (Shulchan Aruch) or cancelled (Rema). (See Shulchan Aruch Orach Chaim 568:9.)
The poskim also handle a case of someone who has a Yahrtzeit for a parent on a public fast when they are honored with Sandek by a Bris Milah.
The Tur and Shulchan Aruch (O.C. 559:9) say that a Sandek (for instance) may eat on a Sunday, when Tisha B'Av was pushed to that Sunday from Shabbos. However, the Pri Megadim holds that only a father of the child may do so on a Yahrtzeit, not the Sandek (O.C 568:5).
So, since we see that such cases were brought by the poskim, yet the OP's case was never addressed that I can see; therefore, it seems fair to assume that the poskim held for a simple matter that one may fast on a public fast/Yarhtzeit day, and accomplish both ideas with one fast.
At least one modern day Rav holds that a public fast can accomplish both the Yahrtzeit obligation for a parent as well as doubling for the fast day it falls out on.
Rav Mordechai Eliyahu (a chief Rabbi of Israel from 1983 - 1993) held that if a parent's Yahrtzeit fell out on the day before Yom Kippur, (9th Tishrei) then since one must fulfill the mitzvah to eat on erev Y"K, one cannot fast for a parent. However, they need not make up the fast, since they may count their fast tomorrow on Yom Kippur itelf as the fast for their parent as well. (See Sefer Maamar Mordechai ; English version page 447, Entry #17 )
Also, due to tragedy or coincidence, it is not so rare that both parents might share the same Yahrtzeit. Yet, I do not see any poskim comment that mom and dad need separate days to fast, in such a case?
This is all keeping with the general concept that the fast is to make sure the child raises their spiritual level on the day of a parent's renewed judgement, thereby honoring the parent and attributing merit to them for producing such a meritorious child. It doesn't matter if the child is fasting that day for 2 or 3 separate reasons, as long as the child is repenting and growing spiritually.
But what if you wish to do something specifically special and exclusive for the parent?
The Tanya (Igeres HaTeshuvah) says that nowadays we should not voluntarily fast at all, but rather give charity instead. He says this is because we are weak and fasting would be a sin that could cause neglect of Torah study.
Rabbi Akiva Eiger held this way, since in his will, he asked his children not to fast on his Yahrtzeit, but rather to eat, be strong, and learn extra Torah that day for his soul. (See this sentiment also in Minchas Yitzchak (6:135) and Natei Gavriel II 71:10 that nowadays we do not fast but we give charity to the poor in the merit of the parent's Yahrtzeit.)
Therefore, one whose parent shares their Yahrtzeit with a public fast day, may be given exclusive merits, by having the child learn extra Torah or by giving extra charity, specifically for their parent's soul that day.