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
gmasta1129
Resolver I
Resolver I

If Statement with Column and Measure

Hello,

 

I am having issues with the measure value that pulls in when i use it in an if statement with a column

The formula is as follows...

Measure =  if(daily_report[master portfolio id]=729,[Net FX P&L2],CALCULATE(SUM(daily_report[fx prv])))

Measure = Net FX P&L2

Column = Daily_report[fxprv]

Column = daily_report[master portfolio id]

 

When i add the Net FX P&L2 measure to the power bi table, the correct value pulls in.  The issue is when I include the measure in the "if formula", it sums all values for each day even though i have a date slicer set up on my page (set for 3/28/2022).  it should only pull in the value for 3/28/2022 but is summing all values for all dates (1/1/2022-3/28/2022).  Not sure what i am doing wrong.  

  

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@gmasta1129 , That seem more like column not measure , Try a measure like

 

CALCULATE(SUM(daily_report[fx prv]), filter(daily_report,daily_report[master portfolio id] <> 729))
+ CALCULATE([Net FX P&L2], filter(daily_report,daily_report[master portfolio id] = 729))

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

View solution in original post

Anonymous
Not applicable

Hi @gmasta1129 ,

 

Your formula with IF function seems to be a calculated column, right? A calculated column is static, it won't be changed by the filter of the slicer. However, measures do. You could create a measure instead of the orginal calculated column.

What is the difference between Power BI calculated columns and measures? - TrueCue.

 

 

Best Regards,

Stephen Tao

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @gmasta1129 ,

 

Your formula with IF function seems to be a calculated column, right? A calculated column is static, it won't be changed by the filter of the slicer. However, measures do. You could create a measure instead of the orginal calculated column.

What is the difference between Power BI calculated columns and measures? - TrueCue.

 

 

Best Regards,

Stephen Tao

 

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

 

amitchandak
Super User
Super User

@gmasta1129 , That seem more like column not measure , Try a measure like

 

CALCULATE(SUM(daily_report[fx prv]), filter(daily_report,daily_report[master portfolio id] <> 729))
+ CALCULATE([Net FX P&L2], filter(daily_report,daily_report[master portfolio id] = 729))

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
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