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
Haris-Khan
New Member

How to summarise a measure, currently not summing in matrix subtotals

Hi, 

 

I have created a measure to calculate the number of weeks colleagues are behind on timesheets:

 

Weeks Overdue = CALCULATE(DATEDIFF(LASTDATE(Timesheet_Report[Week_Commencing_Date]),TODAY()-WEEKDAY(TODAY(),1),WEEK),NOT(ISBLANK(Timesheet_Report[Date_Committed])))
 
So the measure takes the number of weeks difference between their last sumbmission and the end of the previous week we are currently in. 
 
The matrix I have includes the teams and colleague names (belong to those teams) as rows and then the measure as the values - which correctly calculates the number of weeks they are behind on timesheets, but does not summarise the total number of weeks each team is behind. 
 
Do you know how I can chnage my DAX code to make this happen or what other steps I could take so that the matrix subtotals (and grand total) sum correctly?
 
Thanks!!
1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Try it like this.

Weeks Overdue Totaled = 
SUMX ( Contacts_Table, [Weeks Overdue] )

You use your existing measure and iterate over the contacts table so the totals add up correctly.

View solution in original post

3 REPLIES 3
jdbuchanan71
Super User
Super User

Try it like this.

Weeks Overdue Totaled = 
SUMX ( Contacts_Table, [Weeks Overdue] )

You use your existing measure and iterate over the contacts table so the totals add up correctly.

Haris-Khan
New Member

The Timesheet_Report contains Contact ID, which have a relationship with a seperate data table that includes the ID and contact name. The Contact ID then has a second relationship with another data table with includes the contact ID and team ID and the the team ID is joined to another dataset that has the team ID and the team name. How do you propose the SUMX code looks? Because the numbers I want to summarise come from the difference between the last submission and the end of the previous week. I tried...

 

SUMX(Timesheet_Report,DATEDIFF(LASTDATE(Timesheet_Report[Week_Commencing_Date]),TODAY()-WEEKDAY(TODAY(),2),WEEK))
 
No luck. 

 

 

jdbuchanan71
Super User
Super User

@Haris-Khan 

How is your data laid out?  Do you have your teams and members in a separate table that is linked to the Timesheet_Report?  You will need to used a SUMX with your measure to calculate the correct subtotals. 

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.