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
Thstorm
Frequent Visitor

Stuck on DAX formula

Hi All,

 

I'm stuck on a DAX formula. I have the following table:

 

_Request_IDLastResponse _Request_Note_ID_Request_Note_ID_HiddenPublic_Note_>_7_Days
4534218610369900
4534217310523710
4534215810694800
4534214510843510
4534213610983310
4534212511110710
453422812363910
45342312721210

 

_Request_ID = is a ticket number (unique per ticket)

LastResponse = Number of days we posted a last response on the ticket

_Request_Note_ID = Unique ID for eacht note on the ticket

_Request_Note_ID_Hidden = 0 is a public note, 1 is a private note

Public_Note_>_7_Days = This column should give a 1 on the last public note (with higest _request_note_ID) when this note is placed more dan 7 days ago. So it should place a one at _request_note_id 106948.

 

 

My DAX formula so far:

Public_Note_>_7_Days =
VAR Max_Value =
        CALCULATE (
        MAX ( Query[_Request_Note_ID] ),
        FILTER ( Query, Query[_Request_ID] = EARLIER ( Query[_Request_ID] ) )
    )
RETURN
    IF (AND ( Query[_Request_Note_ID] = Max_Value,Query[LastResponse ] > 7), 1,0 )
 
Any help is welcome!
 
Thanks
1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@Thstorm

 

Seems you missed this parameter only

 

Public_Note_>_7_Days =
VAR Max_Value =
    CALCULATE (
        MAX ( Query[_Request_Note_ID] ),
        FILTER (
            Query,
            Query[_Request_ID] = EARLIER ( Query[_Request_ID] )
                && [_Request_Note_ID_Hidden] = 0
        )
    )
RETURN
    IF (
        AND ( Query[_Request_Note_ID] = Max_Value, Query[LastResponse ] > 7 ),
        1,
        0
    )

Regards
Zubair

Please try my custom visuals

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

@Thstorm

 

Seems you missed this parameter only

 

Public_Note_>_7_Days =
VAR Max_Value =
    CALCULATE (
        MAX ( Query[_Request_Note_ID] ),
        FILTER (
            Query,
            Query[_Request_ID] = EARLIER ( Query[_Request_ID] )
                && [_Request_Note_ID_Hidden] = 0
        )
    )
RETURN
    IF (
        AND ( Query[_Request_Note_ID] = Max_Value, Query[LastResponse ] > 7 ),
        1,
        0
    )

Regards
Zubair

Please try my custom visuals

Thats it! Thanks!

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.