I was trying to figure out what chord some melody is based on , and the problem is I can't name it. It is like Dm6 without 5th. And also it could be Bdim. It consists of D,B,F
In the most strict analysis, there are two chords in the measure: both Bdim and Dmin.
The initial C is a suspension from the previous measure. It resolves down to the B, forming a brief Bdim chord that immediately proceeds to Dmin. The following C is an anticipation, leading to the Amin in the next measure.
Although Bdim is "required" analytically, I would consider it as a passing chord, being so brief, and would think of the measure as simply being Dmin.
All in all, the three measures show what is called a "tonic expansion": i-(ii)-iv-i.
no b in the chord. This is not 19c harmony, the c is not a dissonance that needs to resolve. Laitz et al not relevant for this type of harmony. Am and Dm7. (emphasis mine)
This comment from @DamianleGassick should be taken to heart. The music in question was not written with adherence to common-practice tonality / functional harmony in mind. (I should say, "presumably not written..." as a hedge, as I'm ot familiar with the piece.) While I stand by the analysis of how the two measures in the OP function, it should always be kept in mind that in a great deal of contemporary music -- jazz and pop, especially -- chordal sevenths are not considered dissonant and are not intended or expected to operate as they would according to the strictures of (classical) functional analysis.
Based on the excerpt shown, I would actually argue for another understanding: Dm7.
Since the stem-down D and F are held throughout the entire measure, we can assume they're chord tones unless other information suggests otherwise.
Now we have to determine which of the stem-up notes—C, B, and A—are chord tones. In order to do this, we often privilege two things: metrical placement and note length (what we call an "agogic accent").
In terms of metrical placement, we privilege notes that appear on the beat as opposed to off the beat. This logic suggests that the C and A would be chord tones, but not the B.
And the agogic accent suggests the same: B, being the shortest note in the entire measure, is most likely a non-chord tone.
With all of this in mind, we have the dotted-half D and F combined with the upper-voice A and C to create a Dm7 chord.
There are other readings, but this would be my preferred one.