Forum Discussion

brdrok's avatar
brdrok
Helper I
1 year ago

Query timeout question (i.e Query has exceeded the available resources)

Hi,

I have a DAX question regarding why one query times out while the other one does not.  The query below runs in 500ms or so

 

 

ShortTermGainLoss = 
var curSTFLag = SELECTEDVALUE(FactGL[STFlag], BLANK()) 
var curRGL = [RGL]
var result = if(curSTFLag = "ST", curRGL , BLANK())  ---- 500ms
RETURN
result

 

 

 

Essentially the same query except the BLANK() is replaced with a variable named curZero

 

 

ShortTermGainLoss = 
var curSTFLag = SELECTEDVALUE(FactGL[STFlag], BLANK()) 
var curRGL = [RGL]
var curZero = 0.00
var result = if(curSTFLag = "ST", curRGL , curZero)  ---- times out
RETURN
result

 

 


Preferably I would like to show $0.00 as opposed to Blank.  I hope someone can provide me with a cliff note version as to why that is and how to code around that.  Thank you.

P.S.
Tried wrapping the "result" variable in either the COALESE function like so:

COALESCE
(
    result,
    0.00
)
or the ISBLANK function:
 IF
 (
     ISBLANK
     (
         result
     ),
    0.00,
     result
 )
 



 

 

3 Replies

  • Connect DAX Studio to whatever instance you are using for this (local or service) and then compare the query plans and server timings.

     

    Preferably I would like to show $0.00 as opposed to Blank.  

    Make sure your users are ok with that. The absence of something does not necessarily equate to $0

     

  • Sorry for letting the question die.  I have moved the logic into a calculated column.  No my favorite choice but I don't want to spend more on it.  Thank you.