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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
SWilson_GS
Helper I
Helper I

All Time "Best Month" Production

Hello! I'm struggling trying to present a "top month" view for production for all time. i.e. one producer's best month may have been April 2018 while another's best production month may have been September 2020. I'm using 

 

BestMonth =
if(HASONEVALUE(Table[LoanOfficerName]),MAXX(SUMMARIZE('Date',[Year],'Date'[Monthnumber],"ABCD",[$TotalSales]),[ABCD]),BLANK())
 
And this displays as expected. However, now I'm trying to also display the month/year next to that measure in the same table. I've been playing around with the same measure to display the month/year but failing. Any help?
 
Thanks in advance!
2020-12-22_12-16-02.jpg
 
1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this measure expression.  It returns both the max amount and the date it occurred on.  If there is a tie, it will concatenate them together.

 

Best Month =
VAR vSummary =
    ADDCOLUMNS (
        SUMMARIZE (
            'Table',
            'Table'[CloseDate],
            'Table'[LoanOfficerName]
        ),
        "cProduction",
            CALCULATE (
                SUM ( 'Table'[Production] )
            )
    )
VAR vMaxProd =
    CONCATENATEX (
        TOPN (
            1,
            vSummary,
            [cProduction], DESC
        ),
        'Table'[CloseDate] & " - "
            FORMAT (
                [cProduction],
                "Currency"
            ),
        "; "
    )
RETURN
    vMaxProd

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

6 REPLIES 6
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this measure expression.  It returns both the max amount and the date it occurred on.  If there is a tie, it will concatenate them together.

 

Best Month =
VAR vSummary =
    ADDCOLUMNS (
        SUMMARIZE (
            'Table',
            'Table'[CloseDate],
            'Table'[LoanOfficerName]
        ),
        "cProduction",
            CALCULATE (
                SUM ( 'Table'[Production] )
            )
    )
VAR vMaxProd =
    CONCATENATEX (
        TOPN (
            1,
            vSummary,
            [cProduction], DESC
        ),
        'Table'[CloseDate] & " - "
            FORMAT (
                [cProduction],
                "Currency"
            ),
        "; "
    )
RETURN
    vMaxProd

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thank you! This solution worked best for my purposes.

littlemojopuppy
Community Champion
Community Champion

Can you provide some sample data to work with?

Here's an example. CloseDate is joined on a date table. 

 

Capture.PNG

 

 

 

 

 

 

 

In this last view I'd like "MonthName" to display "2019 - Dec" for Lender 1, "2019 - Dec" for Lender 2, and "2020 - Jan" for Lender 3. 

 

Please let me know if that doesn't make sense, thanks!

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

Hi!  I came up with this...

 

Best Production Month:=VAR	MonthlySummary =
		GROUPBY(
			Production,
			Production[LoanOfficer],
			Production[CloseDate],
			"MonthlyProduction",
			SUMX(
				CURRENTGROUP(),
				Production[Production]
			)
		)
	VAR	TopPerformingMonths =
		TOPN(
			1,
			MonthlySummary,
			[MonthlyProduction],
			DESC
		)
	RETURN

	CALCULATE(
		FIRSTNONBLANK(
			Production[CloseDate],
			TRUE()
		),
		TopPerformingMonths
	)

 

 

littlemojopuppy_0-1608673243196.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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