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
Anonymous
Not applicable

How to get result for calculated column

Hi, I'm newbie to powerbi. Please do help .
My requirement is to acheive the below Output column(in green).
There are three columns OrderID ,Ordersequence,Estimated Arrival
for OrderID there will be some estimated arrival if it is there then it should be TRUE or it should be false
when the Ordersequence is 1 for OrderID and has estimated arrival for any ordersequence then the Ordersequence 1 should be true because one is considered as Origin
when the Ordersequence is 1 for OrderID and has no has estimated arrival for any ordersequence then the Ordersequence 1 should be False

If there is any estimated arrival for any ordersequence then the Origin(Ordersequence 1 ) should also be TRUE.

 

dheena_0-1607097931850.png

 

In the above example the OrderID  101 has some estimated arrival time so the Origin(OrderSequence 1 )is True

OrderID 102 doesnt have any estimated arrival so the the Origin(OrderSequence 1 )is False.

 

Thanks in Advance.

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

Please try this expression in a calculated column, replacing with your actual Table name to get the result shown.

mahoneypat_0-1607177948553.png

 

Output Column =
VAR vThisID =
    CALCULATE (
        COUNTROWS ( Orders ),
        ALLEXCEPT (
            Orders,
            Orders[Order_ID]
        ),
        NOT (
            ISBLANK ( Orders[EstimatedArrival] )
        )
    ) > 0
RETURN
    IF (
        ISBLANK ( Orders[EstimatedArrival] ),
        IF (
            AND (
                Orders[Order Sequence] = 1,
                vThisID
            ),
            TRUE (),
            FALSE ()
        ),
        TRUE ()
    )

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
Anonymous
Not applicable

 

 
 
 Thanks for the solution it works !!.
mahoneypat
Employee
Employee

Please try this expression in a calculated column, replacing with your actual Table name to get the result shown.

mahoneypat_0-1607177948553.png

 

Output Column =
VAR vThisID =
    CALCULATE (
        COUNTROWS ( Orders ),
        ALLEXCEPT (
            Orders,
            Orders[Order_ID]
        ),
        NOT (
            ISBLANK ( Orders[EstimatedArrival] )
        )
    ) > 0
RETURN
    IF (
        ISBLANK ( Orders[EstimatedArrival] ),
        IF (
            AND (
                Orders[Order Sequence] = 1,
                vThisID
            ),
            TRUE (),
            FALSE ()
        ),
        TRUE ()
    )

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


VijayP
Super User
Super User

@Anonymous 

if(isblank(estimated_arrival),False,true) , let me know if this works




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Anonymous
Not applicable

Hi

Thanks for your effort  still the expected answer for ordersequence 1 also should have True because the OrderID 101 is having estimated arrival time.

Please see below

dheena_0-1607153726039.png

 

OrderID 101 is having some estimated arrival time in any ordersequnce so the orderid 1 is true , but for orderID 102 is not having any estimated arrival so it is False for all ordersequence.

 

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.