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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request 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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors