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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
nora_cy_lee
Frequent Visitor

count # of complaints group by created month and year using DAX commands

I want to count # of complaints group by created month and year using DAX commands.  Complaint # is unique.

Sample data – ComplaintTable:

ComplaintNum       CreatedDate

CO1                        20181102

CO2                        20181104

CO3                        20181228

CO4                        20190115

CO5                        20190220

CO6                        20190229

CO7                        20190305

CO8                        20190407

 

Results:

Created Date     Total

2018-11             2

2018-12             1

2019-01             1

2019-02             2

2019-03             1

2019-04             1

 

I built this DAX column but it seems not working:

TotalComplaintCreated =

COUNTROWS (

  FILTER (

    ComplaintTable,

    ComplaintTable[ComplaintNum] = EARLIER(ComplaintTable[ComplaintNum])

      && MONTH (ComplaintTable[CreatedDate]) = MONTH(EARLIER(ComplaintTable[CreatedDate]))

      && YEAR (ComplaintTable[CreatedDate]) = YEAR(EARLIER(ComplaintTable[CreatedDate]))

))

 

Does anyone know why?  Thanks.

4 REPLIES 4
parry2k
Super User
Super User

@nora_cy_lee convert your created dte column in date data type instead of number/text in current format and then it is super easy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I can confirm the date is 'm/d/yyyy'.  I believe I found the problem and it seems working now.  Thanks.

CreatedDate is already in date format, yyyymmdd.

@nora_cy_lee you see it as date type but if you go on modelling tab, select your created date column, what you see its' data type?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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