Forum Discussion
I need help here
Issue Description
I have selected E-Mail activities and added the Salesperson Name field in the report.
- When I use Salesperson Name from the SALESPERSON_C4C table, the E-Mail records are displayed correctly.
- However, when I switch to the Appointments tab, the visual shows duplicate records due to a cross join.
- If I use Salesperson Name from the APPOINTMENT_INVOLVED_PARTIES table, the Appointments tab works correctly and displays the expected results.
- But when Salesperson Name is taken from the SALESPERSON_C4C table, each appointment gets associated with multiple salespersons, resulting in a Cartesian product (cross join) and duplicate rows.
Current Relationships
- ACTIVITY_AND_VISIT → APPOINTMENT
- Activity_and_Visit Key (1) → Appointment Key (Many)
- ACTIVITY_AND_VISIT → SALESPERSON_C4C
- Many-to-One on Salesperson Key
- ACTIVITY_AND_VISIT → ACCOUNT_C4C
- Many-to-One on Account Key
Observation
The issue occurs only when the Salesperson field is sourced from SALESPERSON_C4C while analyzing Appointments. This causes duplicate rows and cross-joining of appointments with multiple salespersons. Using Salesperson Name from APPOINTMENT_INVOLVED_PARTIES correctly maintains the appointment-to-salesperson relationship and avoids duplicates.
Hi BalajiBuddha ,
Without additional information is difficult to replicate the error, usually this happens when you are using a field from a table that makes the change in the granularity basically when you "join" two fields that aren't related.
You refer that you have also a salesperson on the appointment table, does those columns match the values when you get the information from the activity table or is there any difference between both meaning that the salesperson that comes directly from the appointment is not the same has the one from the activity?
You can try and make a couple of changes to the measure or create an inactive relationship between appointment and salesperson and USERELATIONSHIP syntax.
Try one of the following codes:
Number of all Appointments_App = CALCULATE ( COUNTROWS ( SUMMARIZE ( Appointment_involved_parties_c4c, Appointment_involved_parties_c4c[Appointment Key], SalesPersons_c4c[Salesperson Name] ) ), Appointment_involved_parties_c4c[Role] IN { "Owner", "Attendee" }, Activity_and_visit_c4c[Type Lvl 2_1] <> BLANK () )Other option is to create the inactive relationship and use this one:
Number of all Appointments_App = CALCULATE ( COUNTROWS ( SUMMARIZE ( Appointment_involved_parties_c4c, Appointment_involved_parties_c4c[Appointment Key], SalesPersons_c4c[Salesperson Name] ) ), Appointment_involved_parties_c4c[Role] IN { "Owner", "Attendee" }, Activity_and_visit_c4c[Type Lvl 2_1] <> BLANK (), USERELATIONSHIP(SalesPersons_c4c[SalesPerson Key],Appointment_involved_parties_c4c[SalesPerson Key]) )Hi Balaji
Looking at the measure, i dont see a sales person key used
Can you confirm whether APPOINTMENT_INVOLVED_PARTIES_C4C has a Salesperson Key/Employee ID column, or only the Salesperson Name?
If it only has the name, the bridge should be built on Salesperson Name only if its unique
Could you also confirm the relationship between ACTIVITY_AND_VISIT_C4C and APPOINTMENT_INVOLVED_PARTIES_C4C? Is it directly on Appointment Key
And also the code would be the below only if If APPOINTMENT_INVOLVED_PARTIES_C4C contains the same Salesperson Key/Employee ID that's used in ACTIVITY_AND_VISIT_C4C
Bridge_Salesperson =
DISTINCT (
UNION (
SELECTCOLUMNS (
SALESPERSON_C4C,
"Salesperson Key", SALESPERSON_C4C[Salesperson Key],
"Salesperson Name", SALESPERSON_C4C[Salesperson Name]
),
SELECTCOLUMNS (
APPOINTMENT_INVOLVED_PARTIES_C4C,
"Salesperson Key", APPOINTMENT_INVOLVED_PARTIES_C4C[Salesperson Key],
"Salesperson Name", APPOINTMENT_INVOLVED_PARTIES_C4C[Salesperson Name]
)
)
)
Then create the following relationships:
Bridge_Salesperson[Salesperson Key] (1) → ACTIVITY_AND_VISIT_C4C[Salesperson Key] (*)
Bridge_Salesperson[Salesperson Key] (1) → APPOINTMENT_INVOLVED_PARTIES_C4C[Salesperson Key] (*)
Then use Bridge_Salesperson[Salesperson Name] in your slicer and visuals instead of using the Salesperson field from either table.
9 Replies
- MFelixSuper User
Hi BalajiBuddha ,
Are you using any measures for the calculations or is this a direct count from the tables columns using an implicit measure?
Also how are you setting up the table you only refer that you are getting the email from two different tables but the rest of the values are coming from what tables?
If you are using any DAX measure can you please share them, if possible can you share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.
If the information is sensitive please share it trough private message.- BalajiBuddhaFrequent Visitor
HI MFelix ,
This is the measure and users wants salesperson will words either if you select appointments ot Email, Phone,Task,
Please tell me how to create bridge table and what is relastionships
Thanks,
Balaji.- MFelixSuper User
Hi BalajiBuddha ,
Without additional information is difficult to replicate the error, usually this happens when you are using a field from a table that makes the change in the granularity basically when you "join" two fields that aren't related.
You refer that you have also a salesperson on the appointment table, does those columns match the values when you get the information from the activity table or is there any difference between both meaning that the salesperson that comes directly from the appointment is not the same has the one from the activity?
You can try and make a couple of changes to the measure or create an inactive relationship between appointment and salesperson and USERELATIONSHIP syntax.
Try one of the following codes:
Number of all Appointments_App = CALCULATE ( COUNTROWS ( SUMMARIZE ( Appointment_involved_parties_c4c, Appointment_involved_parties_c4c[Appointment Key], SalesPersons_c4c[Salesperson Name] ) ), Appointment_involved_parties_c4c[Role] IN { "Owner", "Attendee" }, Activity_and_visit_c4c[Type Lvl 2_1] <> BLANK () )Other option is to create the inactive relationship and use this one:
Number of all Appointments_App = CALCULATE ( COUNTROWS ( SUMMARIZE ( Appointment_involved_parties_c4c, Appointment_involved_parties_c4c[Appointment Key], SalesPersons_c4c[Salesperson Name] ) ), Appointment_involved_parties_c4c[Role] IN { "Owner", "Attendee" }, Activity_and_visit_c4c[Type Lvl 2_1] <> BLANK (), USERELATIONSHIP(SalesPersons_c4c[SalesPerson Key],Appointment_involved_parties_c4c[SalesPerson Key]) )
- krishnakanth240Super User
Hi BalajiBuddha
Duplication happening as SALESPERSON_C4C relates to ACTIVITY_AND_VISIT than the Appointment itself where an activity or visit can have multiple salespeople like a team or ownership history. So when you pull Salesperson Name from SALESPERSON_C4C viewing Appointments, Power BI expands each appointment row for every matching salesperson row making a cross join. APPOINTMENT_INVOLVED_PARTIES is at appointment grain with one row per appointment-salesperson involvement so joining through it gives one to one mapping. To my understanding SALESPERSON_C4C is wrong path for appointment level analysis. You might keep using APPOINTMENT_INVOLVED_PARTIES for Salesperson Name whenever you are slicing by Appointments and you can use SALESPERSON_C4C for contexts like plain email activities where it matches
- MohamedFowzan1Super User
From the model and the behavior you've described, it looks like a granularity issue rather than a relationship issue.
A few suggestions:
Verify whether SALESPERSON_C4C is at the same grain asAPPOINTMENT_INVOLVED_PARTIES. If appointments can have multiple salespersons, using SALESPERSON_C4C will naturally create duplicate rows.
For Appointment visuals, use the Salesperson from APPOINTMENT_INVOLVED_PARTIES, as it represents the correct appointment-to-salesperson relationship.
If you need a single Salesperson field across both Emails and Appointments, consider introducing a dedicated Salesperson dimension (or bridge table) instead of relying on different fact tables.
Also check for multiple filter paths or bidirectional relationships in the model, as they can sometimes amplify this type of duplication.
Based on your screenshots, the model seems to be behaving as expected given the current relationships. A small change to the data model should resolve the cross-join issue.- BalajiBuddhaFrequent Visitor
HI MohamedFowzan1
This is the measure and users wants salesperson will words either if you select appointments ot Email, Phone,Task,
Please tell me how to create bridge table and what is relastionships
Thanks,
Balaji.- MohamedFowzan1Super User
Hi Balaji
Looking at the measure, i dont see a sales person key used
Can you confirm whether APPOINTMENT_INVOLVED_PARTIES_C4C has a Salesperson Key/Employee ID column, or only the Salesperson Name?
If it only has the name, the bridge should be built on Salesperson Name only if its unique
Could you also confirm the relationship between ACTIVITY_AND_VISIT_C4C and APPOINTMENT_INVOLVED_PARTIES_C4C? Is it directly on Appointment Key
And also the code would be the below only if If APPOINTMENT_INVOLVED_PARTIES_C4C contains the same Salesperson Key/Employee ID that's used in ACTIVITY_AND_VISIT_C4C
Bridge_Salesperson =
DISTINCT (
UNION (
SELECTCOLUMNS (
SALESPERSON_C4C,
"Salesperson Key", SALESPERSON_C4C[Salesperson Key],
"Salesperson Name", SALESPERSON_C4C[Salesperson Name]
),
SELECTCOLUMNS (
APPOINTMENT_INVOLVED_PARTIES_C4C,
"Salesperson Key", APPOINTMENT_INVOLVED_PARTIES_C4C[Salesperson Key],
"Salesperson Name", APPOINTMENT_INVOLVED_PARTIES_C4C[Salesperson Name]
)
)
)
Then create the following relationships:
Bridge_Salesperson[Salesperson Key] (1) → ACTIVITY_AND_VISIT_C4C[Salesperson Key] (*)
Bridge_Salesperson[Salesperson Key] (1) → APPOINTMENT_INVOLVED_PARTIES_C4C[Salesperson Key] (*)
Then use Bridge_Salesperson[Salesperson Name] in your slicer and visuals instead of using the Salesperson field from either table.
- v-abhinavmuCommunity Support
Hi BalajiBuddha,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
Thank you. - v-abhinavmuCommunity Support
Hi BalajiBuddha,
May I check if this issue has been resolved? If not, Please feel free to contact us if you have any further questions.
Thank you