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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
RafaelAnnibale1
Frequent Visitor

Help With a Calculated Column

I have this Calculated Column that is needed to register the risk category of each project. It does its job, but not entirely. I need to visualize information based on each project for each quarter. For example, in quarter 1, was that project a champion, enabler, performer, or in a risk area? I've developed this Calculated Measure: 

Risk Category =
VAR ProjectName = '5 - KPI & Benefit Achievement - All Zones Unpivot'[Project Name]
VAR TotalAchievement = '5 - KPI & Benefit Achievement - All Zones Unpivot'[Total Achievement]
VAR ROI = '7 - 2a - Global Benefit AC/LE - All Zones Unpivot'[ROI]
VAR Quarter = '5 - KPI & Benefit Achievement - All Zones Unpivot'[Quarter]

RETURN
SWITCH(
    Quarter,
    "Q1",
    SWITCH(
        TRUE(),
        TotalAchievement < 0.75 && ROI > 1, "Performer",
        TotalAchievement >= 0.75 && ROI < 1, "Enabler",
        TotalAchievement >= 0.75 && ROI > 1, "Champion",
        TotalAchievement < 0.75 && ROI < 1, "Risk Area",
        BLANK()
    ),
    "Q2",
    SWITCH(
        TRUE(),
        TotalAchievement < 0.75 && ROI > 1, "Performer",
        TotalAchievement >= 0.75 && ROI < 1, "Enabler",
        TotalAchievement >= 0.75 && ROI > 1, "Champion",
        TotalAchievement < 0.75 && ROI < 1, "Risk Area",
        BLANK()
    ),
    "Q3",
    SWITCH(
        TRUE(),
        TotalAchievement < 0.75 && ROI > 1, "Performer",
        TotalAchievement >= 0.75 && ROI < 1, "Enabler",
        TotalAchievement >= 0.75 && ROI > 1, "Champion",
        TotalAchievement < 0.75 && ROI < 1, "Risk Area",
        BLANK()
    ),
    "Q4",
    SWITCH(
        TRUE(),
        TotalAchievement < 0.75 && ROI > 1, "Performer",
        TotalAchievement >= 0.75 && ROI < 1, "Enabler",
        TotalAchievement >= 0.75 && ROI > 1, "Champion",
        TotalAchievement < 0.75 && ROI < 1, "Risk Area",
        BLANK()
    ),
    BLANK()
)


But the information is wrong. Because how it is returning me: 

Project NameTotal AchievementROIQuarterProject Category
Rockstar Games240.00%13110.57%Q4Enabler
Rockstar Games70.00%13110.57%Q3Risk Area
Rockstar Games013110.57%Q1Risk Area
Rockstar Games013110.57%Q2Risk Area
Bethesda70.00%162.77%Q3Risk Area


By following the rules, the first should be a Champion, and all the others should be a Performer. The logic is: How can I fix it to work considering each and every one of the quarters for every project?

1 ACCEPTED SOLUTION

Total Achievement is a column inside the table: 5 - KPI & Benefit Achievement - All Zones Unpivot
The ROI V2 is a calculated measure. 
I'm using the switch because the quarters are not all the same, i've quarter 1,2,3, 4 and each and every one of the quarter has a different values corresponding the roi and total achievement

View solution in original post

2 REPLIES 2
parry2k
Super User
Super User

@RafaelAnnibale1 First it is not sure if you are adding a column or a measure and also if all the values you are checking ROI, and Total Achievements are columns or measures.

 

2nd, if all the quarters have the same logic (looks like) why you have a SWITCH to check Quarter value?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Total Achievement is a column inside the table: 5 - KPI & Benefit Achievement - All Zones Unpivot
The ROI V2 is a calculated measure. 
I'm using the switch because the quarters are not all the same, i've quarter 1,2,3, 4 and each and every one of the quarter has a different values corresponding the roi and total achievement

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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