Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Count if - Month and Year the same

Hello there,

 

I want to Count date rows, if the month and the year in the row are the same.

Is there a way to do this in DAX?

 

Beste regards

MSOMME

1 ACCEPTED SOLUTION
Jos_Woolley
Solution Sage
Solution Sage

Hi,

MyMeasure =
SUMX (
    'TABLE A',
    0
        + ( EOMONTH ( 'TABLE A'[Created], 0 ) = EOMONTH ( 'TABLE A'[finished], 0 ) )
)

Regards

View solution in original post

5 REPLIES 5
Jos_Woolley
Solution Sage
Solution Sage

Hi,

MyMeasure =
SUMX (
    'TABLE A',
    0
        + ( EOMONTH ( 'TABLE A'[Created], 0 ) = EOMONTH ( 'TABLE A'[finished], 0 ) )
)

Regards

Anonymous
Not applicable

Thanks @Jos_Woolley ,

 

This seems to work so far, but unfortunatly this measures also counts the rows where The [Created] date and the [finished] date are empty. Is there a way to only count the rows, if they both have a value?

 

Best regards 

MSOMME

Ok, then use this:

MyMeasure =
SUMX (
    'TABLE A',
    ( EOMONTH ( 'TABLE A'[Created], 0 ) = EOMONTH ( 'TABLE A'[finished], 0 ) )
        * ( 1 - ISBLANK ( 'TABLE A'[Created] ) )
)

Regards

amitchandak
Super User
Super User

@Anonymous , I am assuming you need a new column

 

New column =

var _eo = eomonth([Date], 0)

return

countx(filter(Table, eomonth([Date], 0)  =_eo), [date])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

I really wasn't specific on this one. I have two dates in my table. A "created" date and a "finished" date.

I want to count those Rows, where both dates have the same Month and Year, so the EOMONTH function sure comes in handy here. 

 

I imagined something like this: COUNTROWS(TABLE A, IF(EOMONTH([Created],0)=EOMONTH([finished],0))

But I already know it isn't gonna work like that.

 

All help is very appreciated! @amitchandak 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.