cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills 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 November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors