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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Snowy34
Helper III
Helper III

Measure with an if statment??

Good morning all,

 

I'm bit new to this and I was hoping someone could give me some help with the below issue I have.

 

I got a simple measure and this works fine but I need to add an IF statement to it, what I need it to do is the following,

 

IF the answer to the below measure is more then [Prime Shelf] value report 0 and if its less report that value. Could someone please show me how to do this.

 

Free Prime Shelfs =
[Prime Shelf] - [Used Prime Shelf]
 
Regards 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Snowy34 

 

 
Free Prime Shelfs =
VAR _ANSWER = [Prime Shelf] - [Used Prime Shelf]
RETURN
IF(_ANSWER > [Prime Shelf], 0, _ANSWER)

Cheers!
A

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Snowy34 

 

 
Free Prime Shelfs =
VAR _ANSWER = [Prime Shelf] - [Used Prime Shelf]
RETURN
IF(_ANSWER > [Prime Shelf], 0, _ANSWER)

Cheers!
A

 

Hi mate,

 

Just tried that and it just returned the same number as before. In this case, the return value should have been 0

 

 

 

Still showing as -108

Hi @Snowy34 ,

Have you solved the problem?

If you have solved the problem, please always always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

If you still need help, please share the data sample and your desired output so that we could help further on it.

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @Snowy34 

Give more info.

It is hard to determine whats wrong according to pieces of information.
But, according to the screenshot below, 'used prome shelf' is 470?
So the calculation is correct. Myabe I got the '>' sign wrong? try using '<' insteaad.

 

Cheers!
A

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors