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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Nyxza
New Member

How to count the column that contain strings Month

Hi,

 

I would like to count row that contain month January, then feb and so on. However the data that i have is not structured. Some are January. Some are January- February. Any shortcuts?

Nyxza_0-1677056231283.png

 

2 REPLIES 2
Anonymous
Not applicable

VishalJhaveri_0-1677058365307.png

Column = 
If(
    CONTAINSSTRING('Table'[Month], "January")
    || CONTAINSSTRING('Table'[Month], "February")
    || CONTAINSSTRING('Table'[Month], "March")
    || CONTAINSSTRING('Table'[Month], "April")
    || CONTAINSSTRING('Table'[Month], "May")
    || CONTAINSSTRING('Table'[Month], "June")
    || CONTAINSSTRING('Table'[Month], "July")
    || CONTAINSSTRING('Table'[Month], "August")
    || CONTAINSSTRING('Table'[Month], "September")
    || CONTAINSSTRING('Table'[Month], "October")
    || CONTAINSSTRING('Table'[Month], "November")
    || CONTAINSSTRING('Table'[Month], "December"),
    1,
    0
)


Then create a measure in which you can do 2 things to get the countrows of requirement.

Measure2 = CALCULATE( COUNTROWS('Table'), 'Table'[Column]=1)

or

CountRowsMeasure = SUM('Table'[Column])


Thank you. 
If my answer helps you, please mark it as solution.

tamerj1
Super User
Super User

Hi @Nyxza 
I hope this is what you're looking for

Please refer to attached sample file with the proposed solution

1.png

Month Count = 
SUMX (
    VALUES ( 'Month Filter'[Month] ),
    COUNTROWS ( 
        FILTER ( 
            'Table',
            CONTAINSSTRING ( 'Table'[Month], 'Month Filter'[Month] )
        )
    )
)

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.