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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Top Kudoed Authors