Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Table visual total

i have data like below 

 

when use max in the column and also in measure the total in the table visual showing max value instead of total.

 

please help iam new to dax

 

  • Hi, Anonymous 

    You can try the following Measure.

     

    max_original_data =

    IF (

        HASONEFILTER ( 'Table'[amount] ),

        MAXA ( 'Table'[amount] ),

        SUMX ( 'Table', 'Table'[amount] )

    )

     

    The Table visual will looks like this:

     

     

    Best Regards,

    Caiyun Zheng

     

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

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

    to get the total amount use the below measure

    Total Amount=

    CALCULATE(sum('Order Details'[Sales])
     
    Where Order details is your table name and Sales is the column name
     
    Appreciate you kudos , Press the thums up button !!
     
  • Hi Anonymous ,

     

    The total row in Power BI is not a sum of the values in a column, it is the measure/calculation in that column calculated with no filters on it, therefore it will just show the MAX of all the unfiltered data, rather than the sum of the MAX values.

     

    In order to help you out more, I'll need you to provide the measure/calculation that you want summed, and a sample of your data in table format such as Excel, or an embedded table in your reply (not a picture). I presume your [amount] column is the one that contains the MAX calculation, so providing that calculation would be helpful.

     

    Pete

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      BA_Pete 

       

      i need to show distinct rows as values in the table visual and also need total as sum of all the rows in the table visual grand total. it is same type of data iam using, different category item so sales amount column has same values since it belongs to same product.

      • BA_Pete's avatar
        BA_Pete
        Super User

        Hi Anonymous ,

         

        I don't feel your reply above has provided the information required, so I've made some assumptions in order to get this fixed for you, because I'm nice like that 🙂

         

        My assumption is as follows:

        You want to display the maximum [amount] value for each [year] / [company] combination in the table rows, but you want the total bar so show the SUM of these MAX value rows.

         

        My solution based on the above assumed requirements:

         

        Use this measure:

        _yourMaxSumMeasure = 
        VAR maxTable =
        SUMMARIZE(
            yourTable,
            yourTable[year],
            yourTable[company],
            "Max Amount", MAX(yourTable[amount])
        )
        RETURN
        SUMX(
            maxTable,
            [Max Amount]
        )

         

        This gives me the following output based on slightly adjusted sample data:

         

        Pete

  • v-cazheng-msft's avatar
    v-cazheng-msft
    Community Support

    Hi, Anonymous 

    You can try the following Measure.

     

    max_original_data =

    IF (

        HASONEFILTER ( 'Table'[amount] ),

        MAXA ( 'Table'[amount] ),

        SUMX ( 'Table', 'Table'[amount] )

    )

     

    The Table visual will looks like this:

     

     

    Best Regards,

    Caiyun Zheng

     

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

  • Hi Anonymous ,

     

    Could you take a look through this thread and mark any answers that have solved your issue as the solution(s) please? This will help others with the same issue to find the answer quicker.

     

    If none of these solve the issue for you, can you provide some more details about where they fall down so we can work to get this resolved for you?

     

    Thanks,

     

    Pete