Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Grand Total of measure doesn't equal sum of row values

Hello,

 

My data is organized in four tables.

image.png

 

 

 

And this is my tables' data

WorkerWorker

 

ProductProduct

 

CommissionCommission

 

SalesSales

 

 

 

 

Than I created this table:

Commission By Worker and ProductCommission By Worker and Product

 

 

Depeding of the worker and the produts it sells, the worker receives a commission. For that I create the following measure:

 

Commision = SUM(Sales[Value]) * SUM(ComissionByProductAndDAy[CommisionPercentage])

It is working, but the only problem is the total ammount of commission. The value must be  21 + 120 + 10 + 105 = 256. I know why it is happenig. I am trying to follow @Greg_Deckler tutorial, about dealing with measure totals - http://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/m-p/63376#U63376

 

But I do not known how to adapt his solution to mine problem. Can someone help me?

 

Thanks. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Greg_Deckler, it not worked using ALLSELECTED(), but your idea to use SUMMARIZE worked. 

 

This is what I did:

 

 

Commission = 
VAR
    _commission = SUM(Sales[Value]) * SUM(ComissionByProductAndDAy[CommisionPercentage])
RETURN
    SELECTCOLUMNS(SUMMARIZE(Sales, 'Product'[ProductID], Worker[Name], "COMMISSION", _commission), "CNAME", [COMMISSION])

View solution in original post

9 REPLIES 9
hthota
Resolver III
Resolver III

Hi 

I hope the below Dax Function will help you.

 

Dax Function: Comission = Sheet1[Value]*Sheet1[Comission Percentage]  (New Column)

 

caaarlos.PNG

Anonymous
Not applicable

@hthota, the problem is that the columns are not on the same table. And both table are not relationed with each other.

User_PBI
Regular Visitor

Hello,

 

Please use the DAX function calculate, this will resolve the issue.

 

Thanks.

Anonymous
Not applicable

@User_PBI, can you show us how, please?

Greg_Deckler
Community Champion
Community Champion

Assuming Commission is a measure, perhaps:

 

MyCommission  = 

IF  (HASONEFILTER(Table[Year]),
  [Commission],
  CALCULATE([Commission],ALLSELECTED(Worker))
)

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler,

 

It did not work. The total value continues the same. I alredy tried to ALLSELECTED for Product and Both - Product and Worker

 

Commission = 
VAR
    _commission = SUM(Sales[Value]) * SUM(ComissionByProductAndDAy[CommisionPercentage])
RETURN
    IF(
        HASONEFILTER(Worker[Name]),
        _commission,
        CALCULATE(_commission, ALLSELECTED(Worker))
    )

 

But  it keeps calculating seventy percent of 1260 that is equals 882. 

 

image.png

 

 

 

What about:

 

MyCommission  = 

IF  (HASONEFILTER(Table[Year]),
  [Commission],
  CALCULATE([Commission],ALLSELECTED())
)

? If that doesn't work, you can always do a SUMMARIZE just as you are doing your table visualization and then just take the SUM of your Commission column in your SUMMARIZE table. 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler, it not worked using ALLSELECTED(), but your idea to use SUMMARIZE worked. 

 

This is what I did:

 

 

Commission = 
VAR
    _commission = SUM(Sales[Value]) * SUM(ComissionByProductAndDAy[CommisionPercentage])
RETURN
    SELECTCOLUMNS(SUMMARIZE(Sales, 'Product'[ProductID], Worker[Name], "COMMISSION", _commission), "CNAME", [COMMISSION])

Awesome!



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors