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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
bernate
Helper III
Helper III

Count rows where month and year are the same across multiple date columns

Hello! I am trying to count the number of times a phase has been completed each month. For this example I am looking at December 2022, so the number of times a phase has been completed during that time is 6.

 

bernate_0-1705102126926.png

 

I started with CALCULATE(COUNTROWS(Table),MONTH(Table[Phase1]) = MONTH(Table[Phase 2])) but quickly realized that I'm only matching on the month and not the year, and that I can't include the other phases because the formula is set up to give a true/false response. 

 

My other thought was to create a calculated table where I append the Phase columns into one and do a count that way, but I was wondering if there would be an easier measure that would get me what I need.

 

Thanks!

3 REPLIES 3
Daniel29195
Super User
Super User

Hello @bernate 

assuming this is the structure of the table you are using, i would suggest to unpivot the table to have the following structure : 

item , phase _ nb , date 

 

then i would create w date table,  and link the date table to the table above on date . 

 

this way,  you only need to create w measure  :  countrows(table_name) . 

 

hope this would help you . 

let me know if you have any concerns, im happy to help .

 

best regards, 

aj1973
Community Champion
Community Champion

Hi @bernate 

You need to create a calculated column and unpivot all phases. Better do it in Power Query and refrence the master table

Please check my solution

https://drive.google.com/file/d/1w3qdBjCnItN8KVrIFuVARctAZ4PcRnKN/view?usp=sharing

Open Power Query

aj1973_0-1705105454917.png

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

HI Amine, I essentially did the same thing by creating a new table and doing a UNION on the phase columns. Is there no way to create a measure to do all of this instead?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors