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

IF/DAX Statement

Hey,

Trying to write the following statement, comes up my syntax is wrong though?

Just wondering if anyone could point out where I am going wrong???

 

= IF (Opportunity[Financial Year] = Year((MONTH (Opportunity[ActualCloseDate]) <4, Year(), Year() + 1 )), (Opportunity[ActualCloseDate]), 0)) + (If (Opportunity[Pipeline Reporting Status] = "E) Potential" AND(Opportunity[Status Code] = "live", Opportunity[EstimatedValue.Value]), 0)))

 

Thanks!

     

1 ACCEPTED SOLUTION
Dog
Responsive Resident
Responsive Resident

Hi @bnisbet

 

it's quite difficult to give you exactly the right statement so replace column names as required. 

 

There are a couple of options. the easiest (from a readability point of vew) is to break out the two calculate statements and add them together at the end. I'm guessing at some of the column names. 

 

MyMeasure :=
VAR ProbableVal =
CALCULATE (
Opportunity[EstimatedValue],
Opportunity[Pipeline Reporting Status] = "E",
Opportunity[Status Code] = "Live"
)
VAR ClosedVal =
CALCULATE (
Opportunity[ActualClosedValue],
DATESYTD ( Opportunity[ActualClosedDate], "03/31" ),
Opportunity[Status Code] = "Closed"
)
RETURN
ProbableVal + ClosedVal

 

it may not be what you are after but it might be of some assistance. 

View solution in original post

7 REPLIES 7
CahabaData
Memorable Member
Memorable Member

you have 2 compares here:

 

IF (Opportunity[Financial Year] = Year((MONTH (Opportunity[ActualCloseDate]) <4

 

that needs to be split apart with an AND

 

 

www.CahabaData.com
Habib
Continued Contributor
Continued Contributor

Seems something wrong in highlighted area.

2-13-2017 10-38-51 PM.png

 

 

 

 

I think there is more wrong that just the highlighted area.

 

Are you trying to create a calculated measure or column?

 

Can you post your PBIX file, or a link to a cut down version with a brief description of what you are trying to do?

 

Phil 🙂


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

@Phil_Seamark@Habib 

I am trying to create a measure with the Following Contions:

When an Opportunity has closed within the Finanical Year and the second conition is when an Opportunity is live and has a reporting status of "E) Probable". The measure will then take the Opportunties Values and calculate the total.

 

Thanks for your help!

Dog
Responsive Resident
Responsive Resident

Hi @bnisbet

 

it's quite difficult to give you exactly the right statement so replace column names as required. 

 

There are a couple of options. the easiest (from a readability point of vew) is to break out the two calculate statements and add them together at the end. I'm guessing at some of the column names. 

 

MyMeasure :=
VAR ProbableVal =
CALCULATE (
Opportunity[EstimatedValue],
Opportunity[Pipeline Reporting Status] = "E",
Opportunity[Status Code] = "Live"
)
VAR ClosedVal =
CALCULATE (
Opportunity[ActualClosedValue],
DATESYTD ( Opportunity[ActualClosedDate], "03/31" ),
Opportunity[Status Code] = "Closed"
)
RETURN
ProbableVal + ClosedVal

 

it may not be what you are after but it might be of some assistance. 

bnisbet
Frequent Visitor

@Dog That was a massive help!

After playing about with it a bit, calculates the values!

Thanks Smiley Happy

Dog
Responsive Resident
Responsive Resident

great stuff! 

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.