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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Jack2of3
Helper II
Helper II

Not picking up all IF clauses in new column but does in Measure

Hi all,

I am having an issue with IF.

I created a measure that works correctly:

Attainment Standing = IF([Project Milestone Attainment] >= .9, "Excellent", IF([Project Milestone Attainment] >= .7 && MBIS_PROJ_MILESTONES_V[Project Milestone Attainment] < .9, "Good",IF([Project Milestone Attainment] < .7, "Needs Improvement")))
 
I created a coulmn that does not:
Attainment = IF([Project Milestone Attainment] >= .9, "Excellent", IF([Project Milestone Attainment] >= .7 && MBIS_PROJ_MILESTONES_V[Project Milestone Attainment] < .9, "Good",IF([Project Milestone Attainment] < .7, "Needs Improvement")))
 
It is not identifying "Good" in the column. Need for Legend or Details
 
Jack2of3_0-1640188392581.png

 

1 ACCEPTED SOLUTION

@Jack2of3  I have looked into ot and it seems that you got mixed up between measure and calculated column.

 

While Project Milestone Attainment is a measure, Attainment is used as a calculated column.

Which is why it does not give you the expected result. I understand that you need that as a calculated column becuase you need to use that as a legend. In that case, simply creating calculate column based on a meaure would not give you what you need.

 

One of the ways to do it is by building a table like tfollowing

 

Table =
SUMMARIZECOLUMNS (
    MBIS_PROJ_MILESTONES_V[FISCAL_YR],
    MBIS_PROJ_MILESTONES_V[SLT_NAME],
    MBIS_PROJ_MILESTONES_V[Quarter],
    MBIS_PROJ_MILESTONES_V[ACTIVE_FLAG],
    "_attainment", [_Attainment],
    "Project Milestone Attainment", [Project Milestone Attainment]
)

 

 

smpa01_0-1640268409074.png

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

11 REPLIES 11
VahidDM
Super User
Super User

Hi @Jack2of3 

 

Is [Project Milestone Attainment] a measure? if yes, can you share a formula you used for it?

 

and is it possible to share a sample of your data in a text format with the desired result?

 


Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

smpa01
Super User
Super User

@Jack2of3 

Attainment =
SWITCH (
    TRUE (),
    MBIS_PROJ_MILESTONES_V[Project Milestone Attainment] < .7, "Needs Improvement",
    MBIS_PROJ_MILESTONES_V[Project Milestone Attainment] >= .7
        && MBIS_PROJ_MILESTONES_V[Project Milestone Attainment] < .9, "Good",
    MBIS_PROJ_MILESTONES_V[Project Milestone Attainment] >= .9, "Excellent"
)
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

@smpa01 

I was hopeful🤔

All of the logic should work.

I expanded and sorted the decimal values just to ensure no rounding issues (picking at straws) and got this as the result:

Weird!

Jack2of3_1-1640193570087.png

 

@Jack2of3  is it a measure or calculate column ?

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

The Value I am checking is a measure, The reulting data is a column.

 

I need it to be a column to use in donuts, pies etc.

Jack2of3_0-1640194262951.pngJack2of3_1-1640194292327.png

 

@Jack2of3  can you provide a small sample pbix please?

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

@smpa01 Not sure how to do that

@Jack2of3  I have looked into ot and it seems that you got mixed up between measure and calculated column.

 

While Project Milestone Attainment is a measure, Attainment is used as a calculated column.

Which is why it does not give you the expected result. I understand that you need that as a calculated column becuase you need to use that as a legend. In that case, simply creating calculate column based on a meaure would not give you what you need.

 

One of the ways to do it is by building a table like tfollowing

 

Table =
SUMMARIZECOLUMNS (
    MBIS_PROJ_MILESTONES_V[FISCAL_YR],
    MBIS_PROJ_MILESTONES_V[SLT_NAME],
    MBIS_PROJ_MILESTONES_V[Quarter],
    MBIS_PROJ_MILESTONES_V[ACTIVE_FLAG],
    "_attainment", [_Attainment],
    "Project Milestone Attainment", [Project Milestone Attainment]
)

 

 

smpa01_0-1640268409074.png

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

@smpa01 Thanks for that. I realized last night while watching the Matrix movie (not easy to follow) that the calculated column was doing averages and then decided to create a dimensional table with the three Attainmnet values. I have not tried my solution as yet but the one you provided does work.

Jack2of3
Helper II
Helper II

@amitchandak 

Thank you for the response unfortunately it gave the same result as the IF for the COLUMN.

Jack2of3_0-1640190617233.png

 

amitchandak
Super User
Super User

@Jack2of3 , Try like

 

Switch(True(),
[Project Milestone Attainment] >= .9, "Excellent",
[Project Milestone Attainment] >= .7 , "Good" ,
"Needs Improvement"
)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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