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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors