Forum Discussion

kdrees21's avatar
kdrees21
Helper I
4 years ago
Solved

Max Count Help

I have data that shows Location, shift, and weekday, and customer ID.    What I am trying to accomplish is finding the maximum number of customers on any day and any shift to determine the maximum ...
  • AlexisOlson's avatar
    4 years ago

    This version should be simpler and more efficient:

    MaxCustomers = 
    MAXX (
        SUMMARIZE (
            CALCULATETABLE ( Data, ALLEXCEPT ( Data, Data[Location] ) ),
            Data[Location],
            Data[Shift],
            Data[Weekday],
            "@Count", COUNT ( Data[Customer ID] )
        ),
        [@Count]
    )

     This should work as a measure or a calculated column.