Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
1 year ago
Solved

Column with the maximum value

Hello good afternoon community, for your help with the following query:

I have the following table grouped together:

The Maximum Value of the quantity field is searched (In this case it is 16)

When performing the measured field

Max = MAX('DayWithMaxTransactions'[TransactionCount])
Max = MAXA('DayWithMaxTransactions'[TransactionCount])
Max = MAXX('DayWithMaxTransactions'[TransactionCount])

The result is:

I have tried with the functions it indicates and it keeps giving me the number 3 instead of 16 which would be the correct data.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Chentefx ,

     

    Maybe there're some filters that cauesd the wrong result of your measure.

    You can try this measure:

    HTX_Maximo =
    MAXX (
        SUMMARIZE (
            ALL ( 'DayWithMaxTransactions' );
            'DayWithMaxTransactions'[HProcess].[Año];
            'DayWithMaxTransactions'[HProcess].[Mes];
            'DayWithMaxTransactions'[HProcess].[Día];
            DayWithMaxTransactions[TransactionCount]
        );
        'DayWithMaxTransactions'[TransactionCount]
    )
    

    The ALL function can ignore any filters applied.

     

    Best Regards,

    Stephen Tao

     

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

     

7 Replies

  • You have daily data, so it returns the maximum transactions you had on a single day.

     

    Use an aggregation function like SUMMARIZECOLUMNS over the years and months, and then take the MAXX over that aggregator.

  • Hi,

    This pattern should work

    Measure = MAXX(SUMMARIZE(Calendar,Calendar[year],calendar[month name],"A",[Total]),[A])

    Hope this helps.

    • Syndicate_Admin's avatar
      Syndicate_Admin
      Administrator

      Hello good, I have followed the suggestion only that now it gives me the result of 1.
      Here's the filter from the initial table:

      DayWithMaxTransactions =
      VAR FilteredTable =
      FILTER(
      'HistoryTransaction';
      WEEKDAY('HistoryTransaction'[HProcess]) = WEEKDAY(TODAY())
      && 'HistoryTransaction'[Origen] <> 'HistoryTransaction'[Destino]
      && 'HistoryTransaction'[Destino] = "1"
      && 'HistoryTransaction'[HStatus] = 4
      )
      VAR GroupedTable =
      SUMMARIZECOLUMNS (
      'HistoryTransaction'[HProcess];
      FilteredTable;
      "TransactionCount"; COUNT('HistoryTransaction'[idHistoricoTx])
      )

      RETURN GroupedTable

      Thus the data is grouped and filtered

      Siguiendo la sugerencia del maximo
      HTX_Maximo =
      MAXX(
      SUMMARIZE(
      'DayWithMaxTransactions';
      'DayWithMaxTransactions'[HProcess]. [Año];
      'DayWithMaxTransactions'[HProcess]. [Mes];
      'DayWithMaxTransactions'[HProcess]. [Día];
      DayWithMaxTransactions[TransactionCount]
      );
      'DayWithMaxTransactions'[TransactionCount])

      I have done it in the two ways that have been recommended to me, now I get the result of

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Super User

        The measure you have written is nowhere close to the one which i suggested.  I am referring to the Calendar table - you are not.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Chentefx ,

     

    Maybe there're some filters that cauesd the wrong result of your measure.

    You can try this measure:

    HTX_Maximo =
    MAXX (
        SUMMARIZE (
            ALL ( 'DayWithMaxTransactions' );
            'DayWithMaxTransactions'[HProcess].[Año];
            'DayWithMaxTransactions'[HProcess].[Mes];
            'DayWithMaxTransactions'[HProcess].[Día];
            DayWithMaxTransactions[TransactionCount]
        );
        'DayWithMaxTransactions'[TransactionCount]
    )
    

    The ALL function can ignore any filters applied.

     

    Best Regards,

    Stephen Tao

     

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