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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
carloshluiz
Regular Visitor

Help the formule

Hi friends

I need help building a formula, when all WorkOrder statuses are closed for the same Case Number, it should return the status "Service Completed, Close Case.

When all or some WorkOrder Status are open. It should return with the status "Service Not Completed, Do FUP".

example below.

 

help PBI.png

 

Thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @carloshluiz ,

Please refer to my pbix file to see if it helps you.

Create a column.

RESULT Column =
VAR _countrow =
    CALCULATE (
        COUNTROWS ( Data ),
        FILTER (
            Data,
            Data[Case number] = EARLIER ( Data[Case number] )
                && Data[Work Order status] = EARLIER ( Data[Work Order status] )
        )
    )
VAR _countcase =
    CALCULATE (
        COUNTROWS ( Data ),
        FILTER ( Data, Data[Case number] = EARLIER ( Data[Case number] ) )
    )
VAR answer_ =
    IF (
        Data[Work Order status] = "Open"
            && _countcase = _countrow,
        "Service not completed.Work order open.Do follow up.",
        IF (
            Data[Work Order status] = "Closed"
                && _countcase = _countrow,
            "Service completed.All work order colsed.Close case.",
            IF ( _countcase <> _countrow, "Service Not Completed, Do follow up", BLANK () )
        )
    )
RETURN
    answer_

vpollymsft_0-1654755004131.png

 

 

If I have misunderstood your meaning, please provide your pbix file without privacy information and your desired output.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @carloshluiz ,

Please refer to my pbix file to see if it helps you.

Create a column.

RESULT Column =
VAR _countrow =
    CALCULATE (
        COUNTROWS ( Data ),
        FILTER (
            Data,
            Data[Case number] = EARLIER ( Data[Case number] )
                && Data[Work Order status] = EARLIER ( Data[Work Order status] )
        )
    )
VAR _countcase =
    CALCULATE (
        COUNTROWS ( Data ),
        FILTER ( Data, Data[Case number] = EARLIER ( Data[Case number] ) )
    )
VAR answer_ =
    IF (
        Data[Work Order status] = "Open"
            && _countcase = _countrow,
        "Service not completed.Work order open.Do follow up.",
        IF (
            Data[Work Order status] = "Closed"
                && _countcase = _countrow,
            "Service completed.All work order colsed.Close case.",
            IF ( _countcase <> _countrow, "Service Not Completed, Do follow up", BLANK () )
        )
    )
RETURN
    answer_

vpollymsft_0-1654755004131.png

 

 

If I have misunderstood your meaning, please provide your pbix file without privacy information and your desired output.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula

Result = if(calculate(countrows(Data),filter(Data,Data[Case Number]=earlier(Data[Case Number])))=calculate(countrows(Data),filter(Data,Data[Case Number]=earlier(Data[Case Number])&&Data[Work Order status]=earlier(Data[Work Order status]))),"Service Completed, Close Case","Service Not Completed, Do FUP")

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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