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
govi
Helper II
Helper II

Return "1" based on multiple criteria in other records

Hi all,

 

I have a problem.

This is the table (events) I have:

 

ttt.jpg

 

 

Every time when a user on a specific date and the same "timing" ("morning" or "evening") has the status "Alert" and there are on this specific date for the same user records with status "AlertScore" it has to return "1" in "NewColumn". In all other records "0"has to be returned. So when there is "AlertScore" with no "Alert" it has to rerturn "0" as well.

 

I cannot figure this out, anyone of you can?

Would be great,

 

govi

 

 

 

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

@govi,

 

Create a calculate column using DAX below:

New Column = 
IF (
    Table1[Status] = "Alert",
    0,
    IF (
        CALCULATE (
            COUNTROWS ( Table1 ),
            FILTER (
                ALLEXCEPT ( Table1, Table1[timestamp], Table1[Timing], Table1[User] ),
                Table1[Status] = "Alert"
            )
        )
            <> 0,
        1,
        0
    )
)

Capture.PNG 

 

Community Support Team _ Jimmy Tao

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

4 REPLIES 4
v-yuta-msft
Community Support
Community Support

@govi,

 

Create a calculate column using DAX below:

New Column = 
IF (
    Table1[Status] = "Alert",
    0,
    IF (
        CALCULATE (
            COUNTROWS ( Table1 ),
            FILTER (
                ALLEXCEPT ( Table1, Table1[timestamp], Table1[Timing], Table1[User] ),
                Table1[Status] = "Alert"
            )
        )
            <> 0,
        1,
        0
    )
)

Capture.PNG 

 

Community Support Team _ Jimmy Tao

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

@v-yuta-msft

Thanks for you help.

 

I tailored your solution a bit and it works perfect now

aswinrhs
Advocate I
Advocate I

You can create a calculated column to solve your problem. Refer the below link for detailed explanation. Hope it helps!

 

https://docs.microsoft.com/en-us/power-bi/desktop-tutorial-create-calculated-columns

 

@aswinrhs

 

Thanks for your help

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.