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
joshua1990
Post Prodigy
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.

OrderValueQuantityRatio
100100502
101100  
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
daxer-almighty
Solution Sage
Solution Sage

@joshua1990 

 

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

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

View solution in original post

3 REPLIES 3
daxer-almighty
Solution Sage
Solution Sage

@joshua1990 

 

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

Ratio =
    DIVIDE (
        SUM ( Sales[Quantity] ),
        SUM ( Sales[Value] )
    )
Jihwan_Kim
Super User
Super User

Hi, @joshua1990 

please correct me if I wrongly understood your question.

Please try the below.

 

Picture2.png

 

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.

Linkedin: https://www.linkedin.com/in/jihwankim1975/

 


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


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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

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.