cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NirH_at_BITeam Frequent Visitor
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 v-qiuyu-msft
Moderator

Re: DAX - Better way to write a formula

Hi @NirH_at_BITeam

 

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
NirH_at_BITeam Frequent Visitor
Frequent Visitor

Re: DAX - Better way to write a formula

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

 

NH

Helpful resources

Announcements
Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

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.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 132 members 1,937 guests
Please welcome our newest community members: