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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

Top Solution Authors