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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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