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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Cel87
Frequent Visitor

Not sure how to Filter this.

Hi All,

 

I have a table with a column that looks at programs and a column that looks at phases and another column that has the status of the phases. I want to create another column that will return if  all phases are completed, then return 'completed, or if all phases are not started, then return 'not started', else return 'In Progress"

 

How would i do this in power bi.

 

Cel87_0-1689916152503.png

 

Thank you in advance

1 ACCEPTED SOLUTION
Cel87
Frequent Visitor

I managed to figure this out.

High_Level_Status =
VAR TotalPhases = COUNTROWS(FILTER('Flight Plan', 'Flight Plan'[program] = EARLIER('Flight Plan'[program])))
VAR CompletedPhases = COUNTROWS(FILTER('Flight Plan', 'Flight Plan'[program] = EARLIER('Flight Plan'[program]) && 'Flight Plan'[Phase Status] = "Completed"))
VAR NotStartedPhases = COUNTROWS(FILTER('Flight Plan', 'Flight Plan'[program] = EARLIER('Flight Plan'[program]) && 'Flight Plan'[Phase Status] = "Not Started"))

RETURN
    SWITCH (
        TRUE(),
        CompletedPhases = TotalPhases, "Completed",
        NotStartedPhases = TotalPhases, "Not Started",
        "In Progress"
    )

View solution in original post

3 REPLIES 3
Cel87
Frequent Visitor

I managed to figure this out.

High_Level_Status =
VAR TotalPhases = COUNTROWS(FILTER('Flight Plan', 'Flight Plan'[program] = EARLIER('Flight Plan'[program])))
VAR CompletedPhases = COUNTROWS(FILTER('Flight Plan', 'Flight Plan'[program] = EARLIER('Flight Plan'[program]) && 'Flight Plan'[Phase Status] = "Completed"))
VAR NotStartedPhases = COUNTROWS(FILTER('Flight Plan', 'Flight Plan'[program] = EARLIER('Flight Plan'[program]) && 'Flight Plan'[Phase Status] = "Not Started"))

RETURN
    SWITCH (
        TRUE(),
        CompletedPhases = TotalPhases, "Completed",
        NotStartedPhases = TotalPhases, "Not Started",
        "In Progress"
    )
Cel87
Frequent Visitor

Thank you @Arul Arul,

That partly worked. However, I still have one that's returning 'In Progress', even through all status 'Not Started'.

Any ideas why this may be?

 

Cel87_0-1690150281388.png

 

Arul
Super User
Super User

@Cel87 ,

I belive this is your expectation,

Column = SWITCH(
    TRUE(),
    DISTINCTCOUNT('Table'[Phase Status])=1 && 'Table'[Phase Status] = "Completed","Completed",
    DISTINCTCOUNT('Table'[Phase Status])=1 && 'Table'[Phase Status] = "Not Started","Not Started",
    "In Progress")




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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