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
MichaiahGartner
Frequent Visitor

Filtering/finding most common month & week with a Date/Time Format

I have a table that lists invoices along with a date column that is formatted like 12/12/2012 12:00:00 AM. I want to find (through DAX) the most frequently occuring month and week but am now sure how. 

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

 

Try this

 

  1. Create a Calendar Table with the following calculated colums to extract Month and Week: Month=FORMAT(Calendar[Date],"mmmm") and Week=WEEKNUM(Calendar[Date])
  2. Create a relationship from the Date column of your Data Table to the Date column of your Calendar Table
  3. Write this measure

Invoice count=COUNTA(Data[Invoice Number])

 

You may sort the measure in descending order.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

v-frfei-msft
Community Support
Community Support

Hi @MichaiahGartner,

 

As davehus metioned, I made one sample for your reference.

 

1. Enter the sample data and create some calculated columns in the table.

Month = FORMAT(Invoice[Date],"mmmm")
weeknum = WEEKNUM(Invoice[Date])

2. Create the measures to achieve your goal.

 

Invoice Count Measure = COUNT(Invoice[Month])
Top Month = 
IF (
    NOT ( ISBLANK ( Invoice[Invoice Count Measure] ) ),
    MAXX (
        TOPN (
            1,
            SUMMARIZE (
                Invoice,
                Invoice[Month],
                "Invoice Count", Invoice[Invoice Count Measure]
            ),
            [Invoice Count]
        ),
        Invoice[Month]
    )
)
Top week = 
IF (
    NOT ( ISBLANK ( Invoice[Invoice Count Measure] ) ),
    MAXX (
        TOPN (
            1,
            SUMMARIZE (
                Invoice,
                Invoice[weeknum],
                "Invoice Count", Invoice[Invoice Count Measure]
            ),
            [Invoice Count]
        ),
        Invoice[weeknum]
    )
)

Capture.PNG

For more details, please check the pbix as attached.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

4 REPLIES 4
v-frfei-msft
Community Support
Community Support

Hi @MichaiahGartner,

 

As davehus metioned, I made one sample for your reference.

 

1. Enter the sample data and create some calculated columns in the table.

Month = FORMAT(Invoice[Date],"mmmm")
weeknum = WEEKNUM(Invoice[Date])

2. Create the measures to achieve your goal.

 

Invoice Count Measure = COUNT(Invoice[Month])
Top Month = 
IF (
    NOT ( ISBLANK ( Invoice[Invoice Count Measure] ) ),
    MAXX (
        TOPN (
            1,
            SUMMARIZE (
                Invoice,
                Invoice[Month],
                "Invoice Count", Invoice[Invoice Count Measure]
            ),
            [Invoice Count]
        ),
        Invoice[Month]
    )
)
Top week = 
IF (
    NOT ( ISBLANK ( Invoice[Invoice Count Measure] ) ),
    MAXX (
        TOPN (
            1,
            SUMMARIZE (
                Invoice,
                Invoice[weeknum],
                "Invoice Count", Invoice[Invoice Count Measure]
            ),
            [Invoice Count]
        ),
        Invoice[weeknum]
    )
)

Capture.PNG

For more details, please check the pbix as attached.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi @MichaiahGartner,

 

Does that make sense? If so, kindly mark my answer as a solution to close the case.

 

Regards,
Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

 

Try this

 

  1. Create a Calendar Table with the following calculated colums to extract Month and Week: Month=FORMAT(Calendar[Date],"mmmm") and Week=WEEKNUM(Calendar[Date])
  2. Create a relationship from the Date column of your Data Table to the Date column of your Calendar Table
  3. Write this measure

Invoice count=COUNTA(Data[Invoice Number])

 

You may sort the measure in descending order.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
davehus
Memorable Member
Memorable Member

Top Month = 

IF (
    NOT ( ISBLANK ( "Invoice Count Measure" ) ),
    MAXX (
        TOPN (
            1,
            SUMMARIZE (
                'Your Table',
                'Date Table'[Month Name],
                "Invoice Count", "Invoice Count Measure"
            ),
            [Invoice Count]
        ),
        'Date Table'[Month Name]
    )
)

Hi - Please see the measure I've included for you. I'm assuming that you have a date table linked to the table and the measure is written with this in mind. 

 

Hopefull this helps.

 

D

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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