Forum Discussion

nmaddock's avatar
nmaddock
Helper I
6 years ago

IF statement crashes report

Hi,

 

I need to change one of my dax calculation below to check if the Agreement end date has a value or not because if it does this end date needs to be used. However the IF statement crashes the report.

 

 

Charge Lifts over last 13 weeks = 
CALCULATE( 
     SUM(Job[Charged Quantity]), 
     FILTER(Job, Job[Date] >= [DB Backup Date] -90),
     FILTER(Job, Job[Date] <= [DB Backup Date] -0)         
)

 

Event this Dax would crash the report:

IF(MAX(Agreement[Agreement End Date]) = BLANK(), 10, 20)
     

This is what I really need to change the dax formula too:

IF(MAX(Agreement[Agreement End Date]) = BLANK(),
// If no agreement end date use the db backup date
  CALCULATE(SUM(Job[Charged Quantity]), 
   
    FILTER(Job, Job[Date] >= [DB Backup Date] -90),
    FILTER(Job, Job[Date] <= [DB Backup Date] -0)   
      
 ), 
// If the agreement end date is after the db backup date use the db backup date
     IF(MAX(Agreement[Agreement End Date]) > [DB Backup Date], 
     CALCULATE(SUM(Job[Charged Quantity]), 
   
    FILTER(Job, Job[Date] >= [DB Backup Date] -90),
    FILTER(Job, Job[Date] <= [DB Backup Date] -0)   
      
 ), 
// Has agreement end date and the agreement endate is before the db backup date
 CALCULATE(SUM(Job[Charged Quantity]), 
   
    FILTER(Job, Job[Date] >= MAX(Agreement[Agreement End Date]) -90),
    FILTER(Job, Job[Date] <= MAX(Agreement[Agreement End Date]) -0)  

 ))))

pbix link is below, any help is appreciated as I'm totally stuck in how to resolve this issue.

 

https://www.dropbox.com/s/l0pj9rbvrwtus7k/Termination%20complete%20-%20Copy.pbix?dl=0

 

The report on Terminations and Price Increase crashes.

 

Thanks in advanced Nathan