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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
GustavO65
Helper II
Helper II

How to get the store where the customer has bought more?

Hi. I have fact table with customers sales.

Our customers buy our products in different stores.

 

I had no problem showing in a matrix the purchases made by each client in the different stores within a date range.

But as additional information I must show in a column the name of the store where the customer has bought more.

 

Anyone can help me? Best regards!

 

7 REPLIES 7
Greg_Deckler
Community Champion
Community Champion

@GustavO65 This may help: https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/m-p/985814#M434

 

If that is not specific enough, Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler  tnks for your answer..

I´ll give you more information...

My fact table looks like this...

 

FACT TABLEFACT TABLE

 

When a user ask for sales between 04-01-2020 and 04-30-2020 I´ll show a matrix like this...

 

RESULT.PNG

 

At the moment I didn't find the way to resolve "PRINCIPAL STORE" column...

"PRINCIPAL STORE" is the store where the customer spent more money between selected dates...

 

Right @GustavO65 so that should look something like the following:

 

 

PRINCIPAL STORE = 
  VAR __Table =
    SUMMARIZE(
      'Table',
      [STORE],
      "__Amount",SUM('Table'[AMOUNT])
    )
  VAR __MaxAmount = MAXX(__Table,[Amount])
  VAR __Store = MAXX(FILTER(__Table,[__Amount] = __MaxAmount),[STORE])
RETURN
  __Store
  

 

It's really the pattern I sent before, https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/m-p/985814#M434

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler  tnks for your help..

Now I´m looking how to display "PRINCIPAL STORE" measure as a Row in my matrix.... because I can only use as a value..

I´ll find information about this...

 

Regards

@GustavO65 - There is a "Display on rows" option for a Matrix visualization in the Formatting pane under I believe Values. Also, there is this article: https://exceleratorbi.com.au/measures-on-rows-here-is-how-i-did-it/



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler  I know "Display on Row" feature (I´m using it)..

But doesnt work for this case.. Please check the matrix I must show as a result.. If I use "Display on Row" the resut is not the expected.

 

Regards!

Right, did you check the article? Because it basically uses something like a disconnected table trick to do it. So does my article here: https://community.powerbi.com/t5/Quick-Measures-Gallery/The-New-Hotness-Custom-Matrix-Hierarchy/td-p... but a bit differently.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.