Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SudhanshuD4512
Frequent Visitor

Query Exceeds

I have created a calculated column like this
A=
IF (
ISBLANK('Fact'[Inv No]),
'Fact'[Amt],
IF (
'Fact'[account_id] = "AP",
'Fact'[local_amt],
'Fact'[local_amt] * -1
)
)
After this i have created a measure on top of it Measure = SUM(A)
Now with using this i have to create other calculated column B like 
B= IF(Measure>0,Measure,0)

But when I drag this in table query exceeds resources. I am not sure why this is happening

11 REPLIES 11
v-pgoloju
Community Support
Community Support

Hi @SudhanshuD4512,

 

Just following up to see if the Response provided  was helpful in addressing the issue. if the issue still persists Feel free to reach out if you need any further clarification or assistance.

 

Best regards,
Prasanna Kumar

v-pgoloju
Community Support
Community Support

Hi @SudhanshuD4512,

 

Just following up to see if the Response provided  was helpful in addressing the issue. if the issue still persists Feel free to reach out if you need any further clarification or assistance.

 

Best regards,
Prasanna Kumar

 

v-pgoloju
Community Support
Community Support

Hi @SudhanshuD4512,

 

Thank you for reaching out to the Microsoft Fabric Forum Community, and special thanks to @DNMAF , @kushanNa , @syahmisi98 and @amitchandak  for prompt and helpful responses.

 

I’ve tried to reproduce the scenario using the M code below. Please review and adjust it according to your data source. If the issue still persists, feel free to share more details, and we’ll be happy to assist further.

 

Thanks & Regards,

Prasanna Kumar

SudhanshuD4512
Frequent Visitor

 

Net Activity =
IF (
ISBLANK('Fact'[Inv No]),
'Fact'[Amt],
IF (
'Fact'[account_id] = "AP",
'Fact'[local_amt],
'Fact'[local_amt] * -1
)
)
Debit is calculated as if we sum net activity, if(net activity>0,net activity,0)
Credit if(net activity<0,net activity,0)*-1


Inv NumAccountIDLocal AmountAmt
1000AP300100
1000AP-350200
1000AP400200

input 

Output below i want

Inv NumAccountIDNet Activity DebitsCredits
1000AP3503500




DNMAF
Resolver III
Resolver III

Hi @SudhanshuD4512 ,

as @rohit1991 already mentioned a calculated column is something static it cannot depend on a measure that is something dynamic. 

I created a sample data set using same column and table names you mentioned:

DNMAF_0-1765184670172.png

A measure that does your desired calculation should look like the following one:

B =
VAR _sum = SUMX(
        'Fact',
        IF(
            'Fact'[Inv No] = "",
            'Fact'[Amt],
            IF (
                'Fact'[account_id] = "AP",
                'Fact'[local_amt],
                'Fact'[local_amt] * -1
            )
        )
)
RETURN
   IF(_sum > 0, _sum, 0)
 
Please note that blank and empty string are not the same thing. Depending on the type of your account_id column it could be necessary to replace the condition 'Fact'[account_id] = "AP" by something different. I assumed that it is a string.
 
If you are interested in the details of blank and empty strings and ISBLANK see for example the DAX guide 
 
Hope that helps!
kushanNa
Super User
Super User

Hi @SudhanshuD4512 

 

Is it possible to get a sample PBIX file with the issue you are having? Maybe create a small table with test data and try to recreate the issue?

syahmisi98
Advocate I
Advocate I

You’re using a measure inside a calculated column. That forces Power BI to evaluate the measure (which works in filter context) for every single row during refresh, and then again in visuals.

- Move your calculated column A to Power Query

- Create B as a measure instead of calculated column and then add the measure to your table

Did I answer your question? Mark my post as a solution! Appreciate your Kudos

rohit1991
Super User
Super User

Hii @SudhanshuD4512 

 

Your query exceeds because you are using a measure inside a calculated column, which forces Power BI to recalculate the entire measure for every row, creating a very expensive row-by-row evaluation. Calculated columns cannot depend on measures and this pattern always causes performance issues. Instead, put all logic in a measure only, for example B = IF([Measure] > 0, [Measure], 0), and remove the second calculated column. Measures calculate at query time and will not cause “query exceeds resources,” but calculated columns with measures will.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

I have tried that as well but same issue is there

@SudhanshuD4512 , Unless this calculation has to change based on the visual row, you can have this as a row of a table, like 

Change the calculated column like 
A= Var _1 = IF ( ISBLANK('Fact'[Inv No]), 'Fact'[Amt],
IF (
'Fact'[account_id] = "AP",
'Fact'[local_amt],
'Fact'[local_amt] * -1
))
return IF(_1>0,_1,0)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.