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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
jostnachs
Helper III
Helper III

Adding a calculated colum with different aggregated level

I have Mainaccount and clientname, each mainaccount has multiple clientnames and the mainaccount is client by itself in my client dimensiontable. I have commission in fact policy table. the commission is per each client as shown in screenshot one. but i want to add a new column in policy table where i have to calculate the commission at mainaccount level not at clientlevel. but i am unable to acheive it using allexcept. I am able to achive it as a measure as shown in screenshot2 but i am unable to acheive it as a column. even after using allexcept it doesnt erase the clientname filter.

Below is the dax i have written to add column and below that is the result but i want 145980 to show up not at clientname level

Column : 

TotalEstimatedCommissionByMainAccount_Column =
CALCULATE(
    SUM(V_DimPolicy[EstimatedCommission]),
    FILTER(
        ALL(V_DimClient),
        V_DimClient[MainAccount]=RELATED(V_DimClient[MainAccount]))
 
)

jostnachs_0-1727302245581.png

measure: 

TotalEstimatedCommissionByMainAccount_Measure =
CALCULATE(
    SUM(V_DimPolicy[EstimatedCommission]),
    ALLEXCEPT(V_DimClient,V_DimClient[MainAccount])
 
)
jostnachs_2-1727302538410.png

 

1 ACCEPTED SOLUTION

figured this out... I am just using wrong table in allexcept... thanks all for the help!

View solution in original post

10 REPLIES 10
ryan_mayu
Super User
Super User

could youpls provide some sample data and expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I have Clientname column (dimclienttable), mainaccount column (dimclienttable) and estimatedcommssion column (policytable).dimclienttable and policytable have one-many relationship. I want to add a column in policytable calculated as estimatedcommission at mainaccount level not at client level(one mainaccount has multiple clientnames and the

mainaccount can be client by itself). date is shown below.

ClientNameMainAccountIsMainSum of EstimatedCommission
10 Federal Holdings LLC10 Federal Holdings LLCTRUE$94,163
MV at Boone LLC10 Federal Holdings LLCFALSE$50,769
Davinci Lock Self Storage, Inc.10 Federal Holdings LLCFALSE$939
Bowman RD 1, LLC10 Federal Holdings LLCFALSE$109
10 Federal Finance LLC10 Federal Holdings LLCFALSE$0
10 Federal Sitework LLC10 Federal Holdings LLCFALSE$0
10FSS 1453 Fernwood Glendale Rd Spartan10 Federal Holdings LLCFALSE$0
10FSS 2601 Industrial Dr.10 Federal Holdings LLCFALSE$0
   

$145,980

 

But what is want is an extra column where sumofestimatedcommission summed up to mainaccount level as below:

ClientNameMainAccountIsMainSum of EstimatedCommissionSum of TotalEstimatedCommissionByMainAccount
10 Federal Holdings LLC10 Federal Holdings LLCTRUE$94,163$145,980
MV at Boone LLC10 Federal Holdings LLCFALSE$50,769$145,980
Davinci Lock Self Storage, Inc.10 Federal Holdings LLCFALSE$939$145,980
Bowman RD 1, LLC10 Federal Holdings LLCFALSE$109$145,980
10 Federal Finance LLC10 Federal Holdings LLCFALSE$0$145,980
10 Federal Sitework LLC10 Federal Holdings LLCFALSE$0$145,980
10FSS 1453 Fernwood Glendale Rd Spartan10 Federal Holdings LLCFALSE$0$145,980
10FSS 2601 Industrial Dr.10 Federal Holdings LLCFALSE$0$145,980

 

I am using the below formula:

TotalEstimatedCommissionByMainAccount =
CALCULATE(
    SUM(V_DimPolicy[EstimatedCommission]),
    FILTER(
        ALL(V_DimClient),
        V_DimClient[MainAccount]=RELATED(V_DimClient[MainAccount])
 
)
)
but it is not giving me required result like i showed in above table. instead it still gives me aggregated at clietname level as shown below:
ClientNameMainAccountIsMainSum of EstimatedCommissionSum of TotalEstimatedCommissionByMainAccount
10 Federal Holdings LLC10 Federal Holdings LLCTRUE$94,163$94,163.30
MV at Boone LLC10 Federal Holdings LLCFALSE$50,769$50,769.30
Davinci Lock Self Storage, Inc.10 Federal Holdings LLCFALSE$939$939.45
Bowman RD 1, LLC10 Federal Holdings LLCFALSE$109$108.75
10 Federal Finance LLC10 Federal Holdings LLCFALSE$0$0
10 Federal Sitework LLC10 Federal Holdings LLCFALSE$0$0
10FSS 1453 Fernwood Glendale Rd Spartan10 Federal Holdings LLCFALSE$0$0
10FSS 2601 Industrial Dr.10 Federal Holdings LLCFALSE$0$0

Please help!

Hi,

Share the download link of the PBI file and show the expected result very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

figured this out... I am just using wrong table in allexcept... thanks all for the help!

you can try this

 

=calculate(sum(EstimatedCommission),allexcept(table, MainAccount))





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




figured this out... I am just using wrong table in allexcept... thanks all for the help!

this works as a measure.... but i want it as a calculated column.

Hi, Thanks for the suggestion. I tried the formula and still gives me same values. I dont know what i am doing wrong.

jostnachs_0-1727712429946.png

 

Any help Please @ryan_mayu 

Like i have heirarchy like mainaccount and clientname in one table and have estimated commission in another table. estimated commission is calculated at clientname level. I want to add a column in my fact table calculating estimated commission at mainaccount level not at client level.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.