Forum Discussion

lawada4's avatar
lawada4
Frequent Visitor
3 years ago
Solved

total sum value in table visual is wrong

im trying to calculate the total commission by all salespersons. i have 2 tables , one table shows the commission by catgory and the other table shows sales transactions by salespersons.

 

i created a joining column in power query by concatenating 3 columns in the packages table to have 1 unique key in the tabel so that i can join with the other table.

after i joined the two tables with 1 to many relationship and cross filteting

 

then created a table visual that shows :

agent name - categoty-sales-commission value

 

the sales total is correct but the commission is not correct. the commission is taken from the categories commission table and the rest of columns are from the categories transactions table.

the correct total commission should be much higher=973.605

 

any idea of what could lead to wrong total sum value while value per row is correct

  • Hi lawada4 

    please try

    Total Commission =
    SUMX (
    SUMMARIZE (
    'categories trans',
    'categories trans'[AGENT_NAME],
    'categories trans'[Category]
    ),
    CALCULATE ( SUM ( 'categories trans'[Commission] ) )
    )

4 Replies

  • ValtteriN's avatar
    ValtteriN
    Community Champion

    Hi,

    This is a quite common issue. I recommend reading this article to understand the cause of it: Obtaining accurate totals in DAX - SQLBI

    Additionally it is generally speaking not a good idea to have a "both" directions realtionship between your tables. Try to change the realationship to "single" between your tables. Additionally if you just want to have total disregarding filters use ALL in your dax. E.g. CALCULATE(SUM(Table[column]),ALL(Table))

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi lawada4 

    please try

    Total Commission =
    SUMX (
    SUMMARIZE (
    'categories trans',
    'categories trans'[AGENT_NAME],
    'categories trans'[Category]
    ),
    CALCULATE ( SUM ( 'categories trans'[Commission] ) )
    )

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi @tomsmith213 ,

    You can create another new measure as below and put this new measure to replace the original measure [Sum of Commission] onto the table visual. Later check if it can return the correct total values...

    Sum of Commission = SUM('categories commisions'[Commission']
    New Measure =
    SUMX (
        GROUPBY (
            'categories trans',
            'categories trans'[AGENT_NAME],
            'categories trans'[Categoty]
        ),
        [Sum of Commission]
    )

     

    In addition, you can refer the following links to try to solve your problem...

    Why Your Total Is Incorrect In Power BI - The Key DAX Concept To Understand

    Dax for Power BI: Fixing Incorrect Measure Totals

     

    If the above one can't help you, could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

    And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

    Best Regards

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  lawada4 ,

    Whether your problem has been resolved? If yes, could you please mark the helpful post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours. Thank you.

    Best Regards