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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Alexp81
New Member

Dax Calulation Help

Wondering if anyone has doen this before trying to do in report vs in sql where sales people share the sale if there is a second salesperon presant.

 

Sales Tables

Salesperson ID, salesvalue, secondsalesperson

 

What I am looking to try is sum the salesvalue for the second saleperson and have it attibute to the salesperson in a tableon power bi.  blank when only a single sapersperson.  sales person ID is linked to another table containg sales person data that does the grouping , ID is the same in primary and secondary sales

 

A,500,b

B,200,

A,200,

B,300,C

 

Expected result

SPID, Primay Sales, Secondary Sale

A,700,0

B,500,500

C,0,300

 

Perhaps I have missed soemthing in obvious I have managed to count the sacondary sale for the primary salesperson

Total_secondsales = CALCULATE(
    SUM('table'[Amount Including VAT]),'table'[Second Salesperson Code] <> "")
 
Thanks Everyone
 
A
1 ACCEPTED SOLUTION
AlanFredes
Resolver IV
Resolver IV

Hi Alex,

 

I have worked with sales data like this and what did was to un-pivot the data either in SQL or Power BI Power Query to get the following structure. This also allows you to quickly toggle between what they have as a Primary or Secondary assignment.

IdAmountPrimary/Secondary
A500P
B200P
A200P
B300P
B500S
C300S

 

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

View solution in original post

2 REPLIES 2
AlanFredes
Resolver IV
Resolver IV

Hi Alex,

 

I have worked with sales data like this and what did was to un-pivot the data either in SQL or Power BI Power Query to get the following structure. This also allows you to quickly toggle between what they have as a Primary or Secondary assignment.

IdAmountPrimary/Secondary
A500P
B200P
A200P
B300P
B500S
C300S

 

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

Hi Alan, thanks for the reply, thats where i had got to in my mind, hoped i had missed something.

 

Thank you

 

Alex

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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