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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
markefrody
Post Patron
Post Patron

Total Count in Measure Not Matching with Table Visual

Hi,

 

I have 2 managers wherein their production is measured on the number of sacks that are filled within their work shift excluding their break times.

 

I am using this measure to determine the sack count for each manager:

Spoiler
sack count =
VAR timeIn = MIN ( 'shift_supervisor_break_times'[Start Time] )
VAR timeOut = MAX ( 'shift_supervisor_break_times'[Clock_Out_Rev] )
VAR timeRange =
FILTER (
VALUES ( 'sack_rail_details'[Date Filled] ),  'sack_rail_details'[Date Filled] >= timeIn
&& 'sack_rail_details'[Date Filled] <= timeOut )
VAR break = DATEDIFF( MIN ( 'shift_supervisor_break_times'[Break1 Start] ), MAX ( 'shift_supervisor_break_times'[Break1 End] ), SECOND)
VAR ss = DATEDIFF ( MINX ( timeRange, 'sack_rail_details'[Date Filled] ), MAXX ( timeRange, 'sack_rail_details'[Date Filled] ), SECOND ) - break
VAR mm = ss / 60
VAR hh = mm / 60
VAR _d1 = MINX ('shift_supervisor_break_times', 'shift_supervisor_break_times'[Start Time] )
VAR _d2 = MINX ('shift_supervisor_break_times', 'shift_supervisor_break_times'[Clock_Out_Rev])
VAR sack_count = CALCULATE(COUNTROWS('sack_rail_details'),FILTER('sack_rail_details','sack_rail_details'[Date Filled] >= _d1 &&
'sack_rail_details'[Date Filled] <= _d2))
RETURN
sack_count

Here is  the manager's schedule for Oct 11, 2021:

markefrody_1-1636104888005.png


And from the production schedule for Oct 11, 2021:

markefrody_2-1636104944301.png


Here is what I got:

markefrody_3-1636105013397.png

If you can see the the total is 386 sacks.

 

But when using the table form visual, the count is only 221 sacks:

markefrody_4-1636105177131.png

 

I'm not sure if the measure that I put is correctly capturing the sacks each manager produced within their shift excluding break time since it is not matching with the table visual. 

I have place the pbix file in the below link for reference:
https://www.dropbox.com/s/l961nsj375rkvti/Sacks%20Filled%20Avg%20Rate%20.pbix?dl=0

Appreciate any assistance you can provide. Thanks.

Best regards,
Mark V.

 

4 REPLIES 4
v-henryk-mstf
Community Support
Community Support

Hi @markefrody ,

 

I did the test and don't seem to understand the relationship between the tables created in your data model. I think there should be a one-to-many relationship between Date Table and sack_rail_details, which may be the reason for the wrong result of measure filtering.

vhenrykmstf_0-1636526271102.png


Please answer my confusion, so that I can do further testing. Looking forward to your feedback.


Best Regards,
Henry


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

@v-henryk-mstf 

 

Hi Henry,


Thank you for your response.

I have tried to update "one-to-many" relationship between the Date Table and sack_rail_details table but I am still coming up with the same results. The same is true with the "one-to-many" relationship between the Date Table and shift_supervisor_break_times table. I have made the relationship to the Date Table in order for the other tables have a common field to connect the data. 

I have now updated the relationship to "one-to-many" of Date Table to the other main tables in the link given. 

https://www.dropbox.com/s/l961nsj375rkvti/Sacks%20Filled%20Avg%20Rate%20.pbix?dl=0

Best regards,
Mark V.



lbendlin
Super User
Super User

I don't see where sacks are uniquely linked to supervisors, so you likely experience double counting.  

 

Can you please explain the rationale behind your data model choices?

 

lbendlin_0-1636159483199.png

 

Usually you want to create a snowflake schema with dimensions and facts and 1:* relationships.

Hi @lbendlin,


Thank you for response. There is no unique link between the supervisors to sacks. The link is on the dates wherein:

1. Supervisors
Table: ​shift_supervisor_break_times
Field: Plan Date Only

2. Sacks production
Table: sack_rail_details
Field: Date Filled Date Only

Both of these tables connect to a Date Table which contains "Date" field. 

Helpful resources

Announcements
Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.