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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
jimpatel
Helper V
Helper V

Dax if formula

Hi,

 

Thanks a lot for looking at my post.

 

Any idea for below logic will be appreciated

 

I have ordernumber, operation, date and closed column in power bi. What i am looking for is, if "Closed" column is x for certain operation number then any other line in the same operation number in the same order number should be closed and rest will be open.

 

Raw data

jimpatel_0-1707382386294.png

 

Filtered version

jimpatel_1-1707382403609.png

 

 

Any help will be appreciated

 

Thanks a lot 

 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @jimpatel ,

 

not sure if i fully get you, supposing you have a data table like:

Order Operation Date Closed
2 1 1/1/2024  
2 3 1/2/2024 x
2 3 1/3/2024  
3 1 1/4/2024  
3 3 1/5/2024 x

 

try to add a calculated column like:

Column = 
VAR _closed =
MAXX(
    FILTER(
        data,
        data[Order]=EARLIER(data[Order])
            &&data[operation]=EARLIER(data[operation])
    ),
    data[Closed]
)
VAR _result =
IF(
    _closed = "x",
    "Closed", "Open"
)
RETURN _result

 

it worked like:

FreemanZ_0-1707385488895.png

 

View solution in original post

2 REPLIES 2
jimpatel
Helper V
Helper V

Perfect 🙂

 

This is what exactly i need.

 

You are star

 

Thanks a lot

FreemanZ
Super User
Super User

hi @jimpatel ,

 

not sure if i fully get you, supposing you have a data table like:

Order Operation Date Closed
2 1 1/1/2024  
2 3 1/2/2024 x
2 3 1/3/2024  
3 1 1/4/2024  
3 3 1/5/2024 x

 

try to add a calculated column like:

Column = 
VAR _closed =
MAXX(
    FILTER(
        data,
        data[Order]=EARLIER(data[Order])
            &&data[operation]=EARLIER(data[operation])
    ),
    data[Closed]
)
VAR _result =
IF(
    _closed = "x",
    "Closed", "Open"
)
RETURN _result

 

it worked like:

FreemanZ_0-1707385488895.png

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors