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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
gabitu
Frequent Visitor

Sum of a value per task per days

Hi, I am trying to create a measure summarizing the effort hours (a decimal type) per date (a day) for a given task (a string type)

I have the table tblTasks containing the taskID, taskName, taskEffortHours, and the second table called tblCalendar containing calendarID, taskID, calendarDate. The tables are joined on taskID collumn. 

If I create a card in Power BI with Sum of taskEffortHours and using a date slider where I select the days, but the card is not displaying the sum correctly, it just sumarrizes the taskName names but not the days. That's why I need this measure that will calculate the effortHours per tasks and per days.

Please help with this, I spent days trying to figure out this measure.

 

Many thanks!

2 ACCEPTED SOLUTIONS
Sahir_Maharaj
Super User
Super User

Hello @gabitu,

 

You can use the SUMX function in DAX along with FILTER to iterate through the tblCalendar table and calculate the sum of effort hours for each day and task combination.

Effort Hours Per Task Per Day = 
SUMX(
    VALUES(tblCalendar[calendarDate]), 
    CALCULATE(
        SUM(tblTasks[taskEffortHours]),
        FILTER(
            tblCalendar,
            tblCalendar[calendarDate] = EARLIER(tblCalendar[calendarDate])
        )
    )
)

Should you require further assistance please do not hesitate to reach out to me.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

View solution in original post

Thank you Sahir, works as charm!

View solution in original post

4 REPLIES 4
gabitu
Frequent Visitor

Thank you Sahir, this works as charm!

Sahir_Maharaj
Super User
Super User

Hello @gabitu,

 

You can use the SUMX function in DAX along with FILTER to iterate through the tblCalendar table and calculate the sum of effort hours for each day and task combination.

Effort Hours Per Task Per Day = 
SUMX(
    VALUES(tblCalendar[calendarDate]), 
    CALCULATE(
        SUM(tblTasks[taskEffortHours]),
        FILTER(
            tblCalendar,
            tblCalendar[calendarDate] = EARLIER(tblCalendar[calendarDate])
        )
    )
)

Should you require further assistance please do not hesitate to reach out to me.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Thank you Sahir, works as charm!

Thanks you very much Sahir, I will try!

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 MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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