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
StuartSmith
Power Participant
Power Participant

Measure to count rows where date column contain a specific month.

I have a date column and i need to count the rows for a specific month.  Such as an example, is there a way to create a measure that will count all the rows that contain "March"?  I have tried a few things, but not making any progress.

Thanks in advance

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @StuartSmith ,

 

How about this:

TomsMeasure =
CALCULATE (
    COUNTROWS( Table ),
FILTER ( Date, Date[DateMonth] = "March" ) )

 

Hope that measure gives you some kind of start 🙂 

 

[Edit] In case you do not have a date dimension this might work better:

TomsMeasure =
CALCULATE (
    COUNTROWS( Table ),
 FILTER ( Table, Table[Date].[Month] = "March" ) 
)

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/ 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

4 REPLIES 4
StuartSmith
Power Participant
Power Participant

Thanks, that worked!

tackytechtom
Super User
Super User

Hi @StuartSmith ,

 

How about this:

TomsMeasure =
CALCULATE (
    COUNTROWS( Table ),
FILTER ( Date, Date[DateMonth] = "March" ) )

 

Hope that measure gives you some kind of start 🙂 

 

[Edit] In case you do not have a date dimension this might work better:

TomsMeasure =
CALCULATE (
    COUNTROWS( Table ),
 FILTER ( Table, Table[Date].[Month] = "March" ) 
)

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/ 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Actually, your first suggestion worked...

CALCULATE ( COUNTROWS( 'HR Data' ), FILTER ( 'Dates', Dates[Month Name]= "March" ) )

Hi @StuartSmith ,

 

Oh, awesome! I did not know you had a date dimension 🙂

 

I'll update my previous answer so you can mark it as a solution!

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

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.

April Fabric Community Update

Fabric Community Update - April 2024

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