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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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
VishalJhaveri
Resolver III
Resolver III

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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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

Top Kudoed Authors