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

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.

Reply
Anonymous
Not applicable

Displaying the largest number of sales by a customer based on user chosen date range

 

I have a report where the user chooses the date period and the cards update to show the number of purchases and individual customers.  I've also created a card that show the average number of purchases per customer, by using one measure divided by the other measure. 

 

I'd also like to display the largest number of purchases made by one customer, but unsure how to approach this.  I tried summarise, but this creates a new table and the date slicer has no effect on the table.

 

Capture.PNG

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try measure like this:

Measure = 
CALCULATE (
    MAXX (
        SUMMARIZE (
            'Table',
            'Table'[customer],
            "Total", SUM ( 'Table'[Purchase] )
        ),
        [sum_]
    ),
   ALLSELECTED('Table'[date]
))

test_display largest.PNG

Sample .pbix

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try measure like this:

Measure = 
CALCULATE (
    MAXX (
        SUMMARIZE (
            'Table',
            'Table'[customer],
            "Total", SUM ( 'Table'[Purchase] )
        ),
        [sum_]
    ),
   ALLSELECTED('Table'[date]
))

test_display largest.PNG

Sample .pbix

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@V-lianl-msft  If i wanted to display a column chart, based on this dataset, the x-axis would be the number of purchases made eg in your dataset 15, 33, 37, y-axis would be the number of customers making those number of purchase eg, your dataset would be, 1,1,1.

 

How can I make that table above that would change with the dates?  I suspect it's something to with the same code with SUMMARIZE, but without the MAXX function and create a table?  Something like below, but correct?!

 

Table = CALCULATE(
        SUMMARIZE(
            Missing,
            Missing[LL_ID],
            "Total",SUM(Missing[Missing ID])
            ),
        ALLSELECTED(Dates[Date])
)

 

Anonymous
Not applicable

@V-lianl-msft  Wow, very clever indeed.  Works a treat 😎

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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