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
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
Super User
Super User

@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.


@ 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!:
The Definitive Guide to Power Query (M)

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

 


@ 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!:
The Definitive Guide to Power Query (M)

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/


@ 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!:
The Definitive Guide to Power Query (M)

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.


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.