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

Expression Error

racheljeska_0-1717186826816.png

Hello,

 

How do I fix this error? Thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @racheljeska 

You can try the following

MEASURE =
VAR completedval =
    CALCULATE (
        COUNT ( table[status] ),
        ALLSELECTED ( table ),
        tale[status] = "Completed"
    )
VAR alleval =
    CALCULATE ( COUNT ( table[status] ), ALLSELECTED ( table ) )
RETURN
    IF ( ISFILTERED ( table[status] ), 0, completedval / alleval )

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi,

Thanks for the solution @Anonymous  provided, and i want to offer some more information for user to refer to.

hello @racheljeska , based on the picture you have offered, your completedEval/allEval return a number type, but the "-" is text type,so it will cause the error, you need to change the if situation to the following.

IF (
    NOT ( ISFILTERED ( 'All Incident Evaluation -OSHA'[Status] ) ),
    completedEVAL / allEVAL
)

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Yolo Zhu, 

 

The expression went through, but it is not displaying the same percent as in the pie graph: 

racheljeska_0-1717420729584.png

 

Anonymous
Not applicable

Hi @racheljeska 

Based on your description, please consider to change the calculated column to measure.

Measure =
VAR completedval =
    CALCULATE (
        COUNT ( table[status] ),
        ALLSELECTED ( table ),
        tale[status] = "Completed"
    )
VAR alleval =
    CALCULATE ( COUNT ( table[status] ), ALLSELECTED ( table ) )
RETURN
    completedval / alleval

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi again, 

 

It works: 

racheljeska_0-1717510950935.png

 

But when I click "Overdue" and "Coming Due" is there a way for it to say 0%?

racheljeska_1-1717511004066.pngracheljeska_2-1717511021383.png

 

Anonymous
Not applicable

Hi @racheljeska 

You can try the following

MEASURE =
VAR completedval =
    CALCULATE (
        COUNT ( table[status] ),
        ALLSELECTED ( table ),
        tale[status] = "Completed"
    )
VAR alleval =
    CALCULATE ( COUNT ( table[status] ), ALLSELECTED ( table ) )
RETURN
    IF ( ISFILTERED ( table[status] ), 0, completedval / alleval )

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This is exactly what I need! Thank you!!

Anonymous
Not applicable

I thought variables could only be used in a measure, not a calculated column.

 

--Nate

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.

Top Solution Authors