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

DAX : Create a filtered column based on another column

Hello, 

 

I'm struggling with a DAX column calculation, I want to create a column based on a specific row, there are information about columns concerned : 

 

- Event_Biztranslist : ID of parcel

- Event_Type : Type of event 

- Event_Time : Date/Time of the event 

- Readpoint_Type : "Tunnel" or "Reader" 

- Rank : for each parcel, ranking events by Event_Time (first = most ancient, last = most recent)

 

This is the rule : for each [Event_Biztranslist] print the [Readpoint_Type] associated to the first "ObjectEvent"

 

To illustrate :

 

DrissChm_0-1596029602871.png

 

 

The result in the new column should be : 

Reader

Reader

Reader

Reader

Reader

Tunnel

Tunnel

Tunnel

 

@tex628 

Regards, 

Driss

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try this:

Column =
CALCULATE (
    FIRSTNONBLANK ( 'Table (2)'[Relation_Type], MIN ( 'Table (2)'[Event_Time] ) ),
    FILTER (
        ALLEXCEPT ( 'Table (2)', 'Table (2)'[Event_Biztranslist] ),
        'Table (2)'[Event_Type] = "OE"
    )
)

test_Create a filtered column based on another column.PNG

 

Best Regards,
Liang
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

5 REPLIES 5
tex628
Community Champion
Community Champion

@V-lianl-msft 's solutions should work. 🙂

/ J


Connect on LinkedIn
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try this:

Column =
CALCULATE (
    FIRSTNONBLANK ( 'Table (2)'[Relation_Type], MIN ( 'Table (2)'[Event_Time] ) ),
    FILTER (
        ALLEXCEPT ( 'Table (2)', 'Table (2)'[Event_Biztranslist] ),
        'Table (2)'[Event_Type] = "OE"
    )
)

test_Create a filtered column based on another column.PNG

 

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

Anonymous
Not applicable

Hello Liang, 

 

Many thanks, it works good for me 🙂

Btw, for info I find a solution through an intermediate calculation with boolean :

 

3. Parcels Reworked by Tunnel = 
IF(Qualification[Event_Type] = "ObjectEvent" 
        && Qualification[Readpoint_Type] = "Tunnel"
        && Qualification[Rank] > 1,
        1,0)
 

 Then : 

X. Rework Mode = 
VAR sum_check = CALCULATE(
    SUM(Qualification[3. Parcels Reworked by Tunnel]),
    ALLEXCEPT(Qualification, Qualification[Event_BizTransList])
)
RETURN 
    IF(sum_check = 1, "Tunnel" , "Reader")

 

Yours is more optimized 

 

Best regards, 

Driss

 

Anonymous
Not applicable

Hello @amitchandak 

 

Thanks for your answer, 

The rank had already done in the concerned columns, the idea is to return for each row of the parcel ID, the value of [Readpoint_type] associated to the "ObjectEvent" value 

 

Driss

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.