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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Create a column that counts rows meeting defined criteria.

Hello everyone,

 

I am trying to replicate the following Excel table in Power BI using DAX and Power Query with no success:

Torga_1-1632912595733.png

 

To create the column "Oper_Days_Count" (column E) I have used the following formula: =IF(AND(A4<>A3,B4<>""),1,IF(B4="", "",E3+1)). Some not useful columns are hidden.

 

Please notice that when there is a change in the content of the column "ID", the counter in "Oper_Days_Count" re-starts in 1.

 

Any idea on how to recreate this in Power BI without having to modify the source Excel file?

 

Many thanks for the attention you are giving to this request.

2 REPLIES 2
Anonymous
Not applicable

@Greg_Deckler many thanks for the answer. I was looking at it, very creative I must say and not only the name... I have not tried it yet, I will be out for a few days; once I am back, I will try and will let you know.

Greg_Deckler
Community Champion
Community Champion

@Anonymous You need Cthulhu or Bride of Cthulhu:

Cthulhu - Microsoft Power BI Community

Bride of Cthulhu! - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.