Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Solved! Go to Solution.
Hi,
Try this
Invoice count=COUNTA(Data[Invoice Number])
You may sort the measure in descending order.
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] ) )
For more details, please check the pbix as attached.
Regards,
Frank
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] ) )
For more details, please check the pbix as attached.
Regards,
Frank
Hi @MichaiahGartner,
Does that make sense? If so, kindly mark my answer as a solution to close the case.
Regards,
Frank
Hi,
Try this
Invoice count=COUNTA(Data[Invoice Number])
You may sort the measure in descending order.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |