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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
SNad_11
New Member

Nested IF/AND Statement Help

Hello everyone, I am trying to find the best way to translate the below excel formula into PowerQuery in PowerBi. 

 

The data is project and date information and essentially the formula looks and compares dates against one another to provide a status. I appreciate that the syntax for IF statements in PowerQuery is 'if x then x else x'. 

 

In Excel it is expressed as follows:

 

=IFS([@[% Complete]]=1,"Complete",[@[Baseline_Date)]]>=[@[Current Forecast]], "On Track",AND([@[Baseline_Date)]]>TODAY(),[@[Current Forecast]]>[@[Baseline_Date]]),"At Risk",[@[Baseline_Date]]<TODAY(),"Missed"). 

 

Any help would be much appreciated! 

1 ACCEPTED SOLUTION
Bifinity_75
Solution Sage
Solution Sage

Hi @SNad_11 , try this formule: assuming the table is named "Table1"

Result = if(Table1[% Complete]=1,"Complete",
            if (Table1[Baseline_Date]>Table1[Current Forecast],"On Track",
                if (Table1[Baseline_Date]>TODAY() && Table1[Current Forecast]>Table1[Baseline_Date],"At Risk",
                    if(Table1[Baseline_Date]<TODAY(),"Missed","-"
                    ))))

 Best regards

View solution in original post

3 REPLIES 3
SNad_11
New Member

Thanks Bifinity_75! 

 

That worked for me, also have tried this and this worked too: 

if [Percent_Complete]=1 then "Complete"
else if [Baseline_Date]>= [Forecast_Date] then "On Track"
else if [Baseline_Date]>[Today] and [Forecast_Date]>[Baseline_Date] then "At Risk"
else if [Baseline_Date]<[Today] then "Missed" else ""

v-henryk-mstf
Community Support
Community Support

Hi @SNad_11 ,

 

Whether the advice given by @Bifinity_75  has solved your confusion, if the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.


Looking forward to your feedback.


Best Regards,
Henry

Bifinity_75
Solution Sage
Solution Sage

Hi @SNad_11 , try this formule: assuming the table is named "Table1"

Result = if(Table1[% Complete]=1,"Complete",
            if (Table1[Baseline_Date]>Table1[Current Forecast],"On Track",
                if (Table1[Baseline_Date]>TODAY() && Table1[Current Forecast]>Table1[Baseline_Date],"At Risk",
                    if(Table1[Baseline_Date]<TODAY(),"Missed","-"
                    ))))

 Best regards

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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