Share via

DAX Function not Returning expected values (returns blanks)

Anonymous
2025-02-27T21:45:35+00:00

Hi,

I have a database into which I load financial results. I have table (PBSdata) that contains a field called [Scenario] and this determines if the data you are looking at is Actual, Budget, Forecast, and so on. The transaction amount is field [Amount].

I have the following formulas:

AmountPBS:=CALCULATE(SUM(PBSdata[Amount]))

AmountPBSActToBud:=(CALCULATE([AmountPBS], PBSdata[Scenario]="Budget")-CALCULATE([AmountPBS], PBSdata[Scenario]="Actual"))*[ExpenseIncreaseNegativeLocalMult]

These formulas seem to work most of the times, but it appears that if there are NO rows in a particular filtered situation, then the formula returns a blank.

I have tried wrapping the CALCULATE in an IF statement but I cannot get it to work:

AmountPBS:=IF(ISBLANK(CALCULATE(SUM(PBSdata[Amount]))),0,CALCULATE(SUM(PBSdata[Amount])))

How would you go about ensuring that 0 (zero) is returned in place of a blank?

The reason I need to do this is shown in the attached image. As you can see the AmountPBSActToBud is calculated ONLY when there are transactions (see highlighted cells). You will see that row with no count are not caclulated, however at totals the calculation is correct.

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Ashish Mathur 102K Reputation points Volunteer Moderator
    2025-02-27T23:16:10+00:00

    Hi,

    Share the download link of the Excel file.

    Was this answer helpful?

    0 comments No comments