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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Pillsbury33
Helper I
Helper I

Dividing two fields and a filter

Hello everyone,

 

I’m hoping someone can help with my question. I am trying to divide two calculations in two separate tables with a visual filter. The logic I am looking for is effectively is to create a card visual that shows the following:

 

Measure = count of incidents [Table 1 Count of incidents] by [Table 1 Site] – this will be the report filter, divided by [Table 2 Sum of employees] for [Table 2 Site].

 

Somehow I need to match the site names from the two fields (they will have the same names) to divide the number of incidents (table 1) by the number of employees for the site (table 2).

 

Another solution that I couldn’t get to work was to add a new column to table 1 with the sum of employees for the table 1 site name.

 

I hope this is enough information to determine a solution. If not let me know what else I need to provide.

Table 1Table 1Table 2Table 2Expected outcomeExpected outcome

Thanks!

1 ACCEPTED SOLUTION
v-eachen-msft
Community Support
Community Support

Hi @Pillsbury33 ,

 

Firstly, you need to create a relationship between two tables in the model tab if you don't have it.

Then refer to the following DAX:

Measure =
CALCULATE (
    SUM ( 'Table'[Incident] ) / SUM ( 'Table (2)'[employee] ),
    ALLEXCEPT ( 'Table', 'Table'[Site] )
)

Here is the result.

1-1.PNG

Here is my test file for your reference.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

2 REPLIES 2
v-eachen-msft
Community Support
Community Support

Hi @Pillsbury33 ,

 

Firstly, you need to create a relationship between two tables in the model tab if you don't have it.

Then refer to the following DAX:

Measure =
CALCULATE (
    SUM ( 'Table'[Incident] ) / SUM ( 'Table (2)'[employee] ),
    ALLEXCEPT ( 'Table', 'Table'[Site] )
)

Here is the result.

1-1.PNG

Here is my test file for your reference.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
amitchandak
Super User
Super User

@Pillsbury33 , Not sure I got. You need to create a common Site table/dimension and join with both tables.

Then you can create % = divide(Sum(Table1[Incident]),Sum(Table2[Employee]))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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