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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

IF expression give not the expected results

Hi,

I have this table visual. This is some products and the state of each of it. I made a sample formula to calculate the volume depending of the state:
IF(State = 6 ; PMP_NET ; PMP_GROSS)

 

Pmp_Gross is a new calculated column = Pmp_Net * 1,08.
It does not work for the first row of the table but for the other product, it does. And for the total row at the bottom it also does not work. It take the sum of PMP_NET * 1,08. If I remove the first product, the total became exact. It's like the IF expression is looking to all rows and if all rows <> 6, the result is false.

Thanks.

Capture.JPG

4 REPLIES 4
edhans
Super User
Super User

If you are creating a measure, you cannot use IF() that way as it doesn't understand when you pass it a column. You would need use something like:

Test IF = 
IF(
    MAX(Table1[val])=6,
    MAX(Table1[state1]),
    MAX(Table1[state2])
)

If you are trying it in a calculated column, I'd need to see your exact formula, as I cannot get it to fail as you are seeing.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

Hope it will work! I share the file.
As you can see each product has a inventory entry date and a inventory relased date. With this visual I want to see our inventory of product on a specific date. Thats the reason of date columns in some formula. 
Thanks

https://www.dropbox.com/s/fcq0lxp4suftkxi/TestDate.pbix?dl=0

What are you expecting? In the first row, STate <> 6, so it gives you the gross amount - net * 1.08

In the other rows, State = 6, so it gives you the net.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

Sorry, in the first row the result is good but not in the total at the bottom. I got the same error when I use card visual for the total.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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