Forum Discussion

rbowen's avatar
rbowen
Helper III
2 years ago
Solved

Find Or Filter On Maximum Transaction Number For Each Store

I have a database table coming into one of my BI Desktop reports that shows the number of transactions our customers have done at our various stores. Each customer can potentially make a purchase (tr...
  • v-weiyan1-msft's avatar
    2 years ago

    Hi rbowen ,

     

    Based on the example and description you provided, Please try code as below to create measure.
    My Sample:

    Max_Counter = 
    CALCULATE (
        MAX ( 'Table'[Transaction Counter] ),
        ALLEXCEPT ( 'Table', 'Table'[Customer Number] )
    )
    
    Correspond_StoreNumber = 
    MAXX (
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[Customer Number] ),
            'Table'[Transaction Counter] = [Max_Counter]
        ),
        'Table'[Store Number]
    )
    
    Correspond_StoreName = 
    MAXX (
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[Customer Number] ),
            'Table'[Transaction Counter] = [Max_Counter]
        ),
        'Table'[Store Name]
    )
    

    Result is as below.


    Best Regards,
    Yulia Yan


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