Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

MdxScript(Model) Calculation error in measure

Hi

 

I have a measure which was giving an error when I maintained straight forward calculation as "[Target] / [Sales %]", I thought it could be due to blank or 0 value in the Target and maintained a DAX code as below. This code is working fine for few product Id and not for few, ending up with the below error message.

 

Measure 1 =
IF(
OR(
ISBLANK([Target]),
[Target] == 0
),
BLANK(),
[Target] / [Sales %]
)

 

TargetSales %Measure 1
5351.867%28670
5181.867%27764
4881.867%26150

 

 

Conversion error.JPG

 

Any expert advise please.

 

Thanks
Mahad

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

According to the error message, it seems that the problem is caused by the data type mismatch... The required data type is numeric, but the actual data type of [Target] or [Sales %] is Text type.... You can follow the methods below:

1. Please make sure the previous two measures only have the numeric values and the correct data type be set for them just as suggestd by @amitchandak 

yingyinr_0-1662534272415.png

 

2. Update the formula of [Measure 1] as below if you can make sure they only have the numeric values. Later checck if it can work well...

Measure1 =
IF (
    OR ( ISBLANK ( [Target] ), [Target] = 0 ),
    BLANK (),
    DIVIDE ( value([Target]), value([Sales %]), 0 )
)

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

According to the error message, it seems that the problem is caused by the data type mismatch... The required data type is numeric, but the actual data type of [Target] or [Sales %] is Text type.... You can follow the methods below:

1. Please make sure the previous two measures only have the numeric values and the correct data type be set for them just as suggestd by @amitchandak 

yingyinr_0-1662534272415.png

 

2. Update the formula of [Measure 1] as below if you can make sure they only have the numeric values. Later checck if it can work well...

Measure1 =
IF (
    OR ( ISBLANK ( [Target] ), [Target] = 0 ),
    BLANK (),
    DIVIDE ( value([Target]), value([Sales %]), 0 )
)

Best Regards

amitchandak
Super User
Super User

@Anonymous , Check the data type of these two  measures I doubt one of them is text

Also, use Divide

Divide([Target] , [Sales %])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.