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
james8992
Frequent Visitor

Another DAX Calculation Total Not Working

I'm working with consulting projects and am adjusting the schedule if the 90 schedule is greater then the hours remaining in the project (Backlog Hours).  In the example, the project is scheduled for 300 hours but there are only 145.75 remaining.  I have a DAX formula to correctly apply this at the project level where there is FILTER context but have not been able to solve for the total since the total for 90 Days Schedule and 90 Day Schedule Adj should not be the exact same due to my formula reducing the schedule when greater than the remaining hours.

 

PowerBI.PNG

 

Hours Scheduled =
SUM('Consulting Forecast Hours Fact_V'[SumTotalHours])
 
90 Days Schedule =
SUMX (
VALUES ( Date_V[Date] ),
IF (
AND ( Date_V[Date] >= TODAY (), Date_V[Date] <= TODAY () + 90 ),
[Hours Scheduled],
BLANK ()
))
 
90 Day Schedule Adj =
SUMX(
SUMMARIZE(VALUES('SF Project_V'[Project Name]),
"BV", [Total Backlog Hours_R],
"90 Day Schedule1", [90 Days Schedule]),
MIN([BV], [90 Day Schedule1]))
 
Thanks in advance
1 ACCEPTED SOLUTION
Kristjan76
Responsive Resident
Responsive Resident

VAR tbl = 

ADDCOLUMNS(
  SUMMARIZE(
    VALUES('SF Project_V'[Project Name]),
    "BV", [Total Backlog Hours_R],
    "90 Day Schedule1", [90 Days Schedule]
  ),
  "MinVal",MIN([BV], [90 Day Schedule1])
)
RETURN
SUMX(
  tbl;
  [MinVal]
)

View solution in original post

5 REPLIES 5
Kristjan76
Responsive Resident
Responsive Resident

VAR tbl = 

ADDCOLUMNS(
  SUMMARIZE(
    VALUES('SF Project_V'[Project Name]),
    "BV", [Total Backlog Hours_R],
    "90 Day Schedule1", [90 Days Schedule]
  ),
  "MinVal",MIN([BV], [90 Day Schedule1])
)
RETURN
SUMX(
  tbl;
  [MinVal]
)

Kristjan - First THANK YOU so much for taking the time to reply. 

When applying the formula you provided I'm getting an error saying that "The syntax for 'RETRUN" is incorrect."  I'm trying to unwind the error but I'm not sure how to fix it.

Capture2.PNG

just change the seperator commonly used in Europa ";" to "," AND you have to keep the name of the function 
90 Day Schedule Adj = 
VAR tbl = ...

Still getting the same error.

 

Capture3.PNG

you are now missing VAR tbl = 

90 Day .... =
VAR tbl = 

 

AND it seems like you are also missing the ")" to close the ADDCOLUMS function, it should be above the RETURN

 

Regards,

Kristjan

 

 

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.

Top Solution Authors