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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
Employee
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
Employee
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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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