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
PowerBI123456
Post Partisan
Post Partisan

Measure Help

If possible in a measure, I am trying to determine who the requester is on a particular response based on the date. 

 

For example, my data looks like:

PowerBI123456_0-1611179375911.png

 

Based on the data, the requester for each of 2 respones would be:

PowerBI123456_1-1611179411964.png

 Any tips?

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

Hi, @PowerBI123456 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

a1.png

 

You may go to 'Query Editor' and add an index column.

a2.png

 

Then you may create a measure as below.

Requestor = 
var maxindex =
CALCULATE(
    MAX('Table'[Index]),
    FILTER(
        ALL('Table'),
        [Date]<MAX('Table'[Date])&&
        [Action]="Request"
    )
)
return
IF(
    MAX('Table'[Action])="Response",
    MAXX(
        FILTER(
            ALL('Table'),
            [Index]=maxindex
        ),
        [User]
    )
)

 

Result:

a3.png

 

Best Regards

Allan

 

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

6 REPLIES 6
v-alq-msft
Community Support
Community Support

Hi, @PowerBI123456 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

a1.png

 

You may go to 'Query Editor' and add an index column.

a2.png

 

Then you may create a measure as below.

Requestor = 
var maxindex =
CALCULATE(
    MAX('Table'[Index]),
    FILTER(
        ALL('Table'),
        [Date]<MAX('Table'[Date])&&
        [Action]="Request"
    )
)
return
IF(
    MAX('Table'[Action])="Response",
    MAXX(
        FILTER(
            ALL('Table'),
            [Index]=maxindex
        ),
        [User]
    )
)

 

Result:

a3.png

 

Best Regards

Allan

 

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

littlemojopuppy
Community Champion
Community Champion

@PowerBI123456 this could be either very easy or very difficult.

 

How are you determining what someone is the Requestor of?  Is there a ticket number or something (not included in data)?  Is it sequentially...and what if the data happens to be in a different order?

Yup, there is an account number included.  Yes it is sequential. 

Can you provide some sample data that includes that?  Because I'd hate to assume incorrectly...

@littlemojopuppy  You can assume all of these have the same account number and are in sequential order. 

Hi @PowerBI123456 ,

 

try the following custom column

Requestor = 
    var _date = [Date]
return
if(
    [Action] = "Response", 
        CALCULATE(MAX('Table'[User]),TOPN(1, FILTER('Table', 'Table'[Date] < _date && [Action] = "Request"), [Date], DESC))
    , BLANK()
    )

richbenmintz_0-1611190991250.png

 

 



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


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.