cancel
Showing results for
Did you mean:
Post Prodigy

## IF ISBLANK Optimization

Hello everyone!

I'm wondering if my current solution is really the best solution. Maybe someone else can provide some feedback on that measure.

I have a simple transaction table with the following 3 columns. The 4th column is the result of the dax measure.

 Order Value Quantity Ratio 100 100 50 2 101 100 102 50

The objective of the Dax Measure "Ratio" is to calculate the ratio between Value and Quantity. But, if a column contains no value, than the result should be BLANK. This is my current solution:

Ratio =
VAR _Quantity =
SUM ( Sales[Quantity] )
VAR _Value =
SUM ( Sales[Value] )
VAR _Ratio =
DIVIDE (
_Quantity,
_Value
)
RETURN
IF (
OR (
ISBLANK ( _Quantity ),
ISBLANK ( _Value )
),
BLANK (),
_Ratio
)

1 ACCEPTED SOLUTION
Solution Sage

Mate, all you need is this formula (and it's faster for obvious reasons):

Ratio =
DIVIDE (
SUM ( Sales[Quantity] ),
SUM ( Sales[Value] )
)
3 REPLIES 3
Solution Sage

Mate, all you need is this formula (and it's faster for obvious reasons):

Ratio =
DIVIDE (
SUM ( Sales[Quantity] ),
SUM ( Sales[Value] )
)
Community Champion

Hi, @joshua1990

please correct me if I wrongly understood your question.

Please try the below.

Ratio 2 =
COALESCE (
DIVIDE ( SUM ( 'Table'[Quantity] ), SUM ( 'Table'[Value] ), "" ),
""
)

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

Post Prodigy

Thanks, but why would you say your measure works better? What is the advantage here?

Announcements

#### Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

#### Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

#### Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Top Solution Authors
Top Kudoed Authors