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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
onebrady
Regular Visitor

Date Calculation and Filtering Issues

I am working with a TimeClock database.  This database tracks Projects performed in an auto repair shop.

 

The employees clock in and clock out of each job.  The "Job"  has a specific code.  Multiple people could login and apply time to any particular job.  The time is registered in the database using a (Time IN) and (Time Out) seperate entry so in order to get the actual time worked on a job I have to calculate the difference between the Time IN and Time Out.

I'm using this DAX in a quick measure
DATEDIFF ( 'EmployeeHours'[TimeIn], 'EmployeeHours'[TimeOut], MINUTE ) / 60.00

 

The problem with this is that I'm trying to create a visual that details which jobs are in progress currently.  When I apply a FILTER to show only those jobs the calculation for All the time applied is only calculated for the resulting data set and no longer includes the total time applied to that specific job.

 

How can I get the totatl time calculation to remain the same regardless of if a filter is applied or not?

 

Before Filter:

 

Before Filter

 

 

After Filter:

After Filter

 

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

 

Try this measure

 

=IF(HASONEVALUE(Data[CostCode]),[your measure],CALCULATE([your measure],ALL(Data[CostCode])))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

 

Try this measure

 

=IF(HASONEVALUE(Data[CostCode]),[your measure],CALCULATE([your measure],ALL(Data[CostCode])))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

This actually helped a great deal.  I wasn't aware of how to use ALL()

 

Thank you so much Ashish

onebrady
Regular Visitor

Does anyone have any ideas on this issue?  It would help me greatly to get this figured out.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors