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
Anonymous
Not applicable

DAX measure calculate hours for each day

Hi Community! 

 

I have a report I'm working on, and I need to calculate the hours that were logged every day. 

The problem I'm having is that the hours seem to calculate alright for each day in the data view. 

ExampleTable.PNG

It calculates per employee the number of hours worked on a certain day. 

However, when I drag hours into the view it automatically aggregates it to month: 

 

 

 

 

ExampleAggregation.PNG

I tried to make a measure called CorrectBillableHours that looks the following: 

CALCULATE(MIN(BillableHours[Hours]); Date[FullDate])  but this just sums the hours to 160 for every date as you can see in the example. 

 

How can I fix this that it just shows the amount of Hours worked for each day? 

Is it a data model problem? Am I using a wrong measure?    

 

Thanks for the help in advance. 

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

Since there is no specific PBIX fileI have tried to select part of data and provide two ways to solve your problems:

1.You can create the following measure directly to calculate the hours that were logged every day:

         Total = CALCULATE(SUM('BillableHours'[Hours]) ,FILTER('BillableHours','BillableHours'[DateKey] in FILTERS('Date'[FullDate])))

 

You will get the result like this:

  Date4.png

2.Create relationships between two tables but you should change the Datekeys data type first:

Select Edit Queries and in Transform plate, choose Datekey column and change the data type into date, close and apply Edit Queries

Date1.png

 

Then in Home plate, select Manage Relationships, create relationships between two tables when you select Datekey column and FullDate column

Date2.png

 

Finally choose a table visual and put FullDate column and Hours column in it, you will get the result like this:

Date3.png

 

Here is the demo , please try it:

PBIX 

 

Best Regards,

Yingjie Li

 

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

View solution in original post

4 REPLIES 4
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

Since there is no specific PBIX fileI have tried to select part of data and provide two ways to solve your problems:

1.You can create the following measure directly to calculate the hours that were logged every day:

         Total = CALCULATE(SUM('BillableHours'[Hours]) ,FILTER('BillableHours','BillableHours'[DateKey] in FILTERS('Date'[FullDate])))

 

You will get the result like this:

  Date4.png

2.Create relationships between two tables but you should change the Datekeys data type first:

Select Edit Queries and in Transform plate, choose Datekey column and change the data type into date, close and apply Edit Queries

Date1.png

 

Then in Home plate, select Manage Relationships, create relationships between two tables when you select Datekey column and FullDate column

Date2.png

 

Finally choose a table visual and put FullDate column and Hours column in it, you will get the result like this:

Date3.png

 

Here is the demo , please try it:

PBIX 

 

Best Regards,

Yingjie Li

 

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

Anonymous
Not applicable

just right click on column and click on "Don't summerize".

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

Anonymous
Not applicable

I've tried that but it still gives the same result. 

Anonymous
Not applicable

share your pbix.

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.