Forum Discussion

danb's avatar
danb
Resolver I
8 years ago
Solved

Plot Store with Max Sales over Time Period

Hi Gurus!    I have a list of stores and plates that I want to chart out. The issue is I am trying to figure out how to plot (on a line graph) the store that has the most amount of sales over the t...
  • v-piga-msft's avatar
    v-piga-msft
    8 years ago

    Hi danb,

     

    1. Create the two measures:

     

     

    the_store_for_max_sales =
    VAR maxstore =
        CALCULATE (
            MAX ( 'Table'[Store #] ),
            FILTER ( 'Table', 'Table'[Quantity Sold] = MAX ( 'Table'[Quantity Sold] ) )
        )
    RETURN
        CALCULATE (
            SUM ( 'Table'[Quantity Sold] ),
            FILTER ( 'Table', 'Table'[Store #] = maxstore )
        )
    
    Measure 2 =
    VAR temp =
        MAXX (
            TOPN (
                1,
                SUMMARIZE (
                    ALLSELECTED ( 'Table' ),
                    [Plate],
                    [Store #],
                    "Total", SUM ( [Quantity Sold] )
                ),
                [Total], DESC
            ),
            [Store #]
        )
    RETURN
        IF ( MAX ( 'Table'[Store #] ) = temp, "Y", "N" )
    

    2.  Drag the measure2 to visual level filter like below.

     

     

    For more details, you could have a reference of the attachment.

     

    Best  Regards,

    Cherry