cancel
Showing results for
Did you mean:
Frequent Visitor

## DAX - Better way to write a formula

Hi,

I use ISBLANK  a lot in one of my BI models and I wonder if there is a better and much more efficient way to write the below measure.

I have many other measures that check first if the result is zero and if not then it applies the formula itself.

Any help would be highly appreciated.

Thanks!

NH

Count Invoice Awaitng Approval OR Partially Approved =
IF (
ISBLANK (
CALCULATE (
COUNTX (
AllJobsData,
AllJobsData[Z02 Count Submitted Invc with NO ApprovedInvc OR Partial Approval]
),
FILTER (
AllJobsData,
AllJobsData[Z02 Count Submitted Invc with NO ApprovedInvc OR Partial Approval] = 1
)
)
),
0,
(
CALCULATE (
COUNTX (
AllJobsData,
AllJobsData[Z02 Count Submitted Invc with NO ApprovedInvc OR Partial Approval]
),
FILTER (
AllJobsData,
AllJobsData[Z02 Count Submitted Invc with NO ApprovedInvc OR Partial Approval] = 1
)
)
)
)
2 REPLIES 2
Moderator

## Re: DAX - Better way to write a formula

You can use Variable in the measure:

Count Invoice Awaitng Approval OR Partially Approved =
VAR t =
CALCULATE (
COUNTX (
AllJobsData,
AllJobsData[Z02 Count Submitted Invc with NO ApprovedInvc OR Partial Approval]
),
FILTER (
AllJobsData,
AllJobsData[Z02 Count Submitted Invc with NO ApprovedInvc OR Partial Approval] = 1
)
)
RETURN
IF ( ISBLANK ( t ), 0, t )

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

## Re: DAX - Better way to write a formula

Not sure if this actually simplifies the formula but thanks anyway!

NH

Announcements

#### Community News & Announcements

Get your latest community news and announcements.

#### Power Platform Summit North America

Register by September 5 to save \$200

#### Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 132 members 1,937 guests
Recent signins: