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
Hawjeen
Frequent Visitor

show the most frequent value with an criteria

Hi all,

 

1'st post, so sorry if it is a repated question, but i haven't been able to find what im looking for.

 

i need to findt the most frequent used store that a salesperson has done sales in

storeInitialsquantityReg_store
s1000TH5s1000
s2000TH3s1000
s1000TH4s1000
s3000CB5s1000

 

My issue is i don't how to get Reg_store. This is a very simple table and i have a more complicated with many stores and initials - i need to find the store where most of the sales are done through.

 

I really hope that someone is able to help me with this, i'm sure it is quite simple.

 

Regards Hawjeen

1 ACCEPTED SOLUTION

Hi @Hawjeen,

I modify Greg_Deckler's formula to add new conditions, you can try to use below formula if it meets for your requirement:

most frequent Store =
VAR summary =
    SUMMARIZE (
        FILTER ( 'Table', [initials] = EARLIER ( 'Table'[initials] ) ),
        [store],
        [initials],
        "Total", SUM ( 'Table'[Quantity] )
    )
VAR _max =
    MAXX ( summary, [Total] )
RETURN
    MAXX ( FILTER ( summary, [Total] = _max ), [store] )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

If you are looking for Mode, see this: https://community.powerbi.com/t5/Quick-Measures-Gallery/Mode-Single-Column/m-p/359150#M101


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

Well, if you want that as a column, you could do this:

 

Column = 
  VAR __Table = 
      SUMMARIZE(
        ALL('Table'),
        [store],
        "__Quantity",SUM('Table'[Quantity])
      )
  VAR __Max = MAXX(__Table,[__Quantity])
RETURN
  MAXX(
    FILTER(
      __Table,
      [__Quantity] = __Max
  )
  

 


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

Thanks for your reply, much appriciated!

 

It kind of works, but not fully. instead of returning the store with highest quantities it simply return the store with higesht number.

 

i think what i need is that is start with filtering on initials, then summarize the quantities to find the max, and then return the store number, could you help me tweak it?

 

Regards 

Hi @Hawjeen,

I modify Greg_Deckler's formula to add new conditions, you can try to use below formula if it meets for your requirement:

most frequent Store =
VAR summary =
    SUMMARIZE (
        FILTER ( 'Table', [initials] = EARLIER ( 'Table'[initials] ) ),
        [store],
        [initials],
        "Total", SUM ( 'Table'[Quantity] )
    )
VAR _max =
    MAXX ( summary, [Total] )
RETURN
    MAXX ( FILTER ( summary, [Total] = _max ), [store] )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

That did the trick!

 

Thanks a lot:)

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.