cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
nmaddock Regular Visitor
Regular Visitor

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

1 REPLY 1
Community Support Team
Community Support Team

Re: IF statement crashes report

@nmaddock 

 

I cannot reproduce the issue with the latest version. You may take a look at https://www.sqlbi.com/topics/optimization/.

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 435 members 3,942 guests
Please welcome our newest community members: