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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Razorbx13
Post Patron
Post Patron

Relationship Totals

I have a Direct Query model with two tables:  Accidents and Incidents.  Accidents is joined to the Incidents table by the Incident ID.  There are Incident IDs in the Incident table that are not related to accidents.  When I create a visual showing a list report by Police Agency I see the join "Count" totals by Agency correctly but the overall totals are showing the total Incidents for the whole table, not the total incidents that have a matching ID.   Like the below.  It is a Many to One join from Accidents to Incidents.  So the questioni is why to I get 154 as a total?  When I remove agency name I get two totals.  77 and 154.  I thought it would be 77 and 77 due to the Many to One join from Accidents to Incidents.  I would expend is Total Incidents to show 154.  Thanks in advance.

 

Agency                    Accidents              Incidents

Agency 1                 23                          23

Agency 2                 21                          21

Agency 3                 33                          33

Total                         77                         154

 

2 REPLIES 2
v-tangjie-msft
Community Support
Community Support

Hi @Razorbx13 ,

 

You can create a new measure.

Measure Sum of Distinct Count Incidents = 
SUMX(
    VALUES(Accidents[Agency]),
    CALCULATE(DISTINCTCOUNT(Incidents[Incident ID]))
)

Add this new measure to your visual, and it should display the correct total count of incidents that have a matching ID.

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

DiKi-I
Helper III
Helper III

Can you please attach your pbix file. 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.