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

Relative Reference

I am trying to write a formula for PowerQuery that looks at a cell value and if it equals a specified value retuns the value of a cell that is in the next row and over one column. I want this value to be returned in its own column and if it does not match it should return a 0. 

 

Here is a link to a sample PBIX. 

https://www.dropbox.com/s/akta8ktlwba4juo/NotReady.pbix?dl=0

 

2018-06-27_18-11-03.jpg

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Since i could not get the ref to work i ended up doing the following

 

Adding two Index columns one starting with 0 the other with 1

 

Doing a merge table with itself and refrencing the two index columns. this shifted the time values to the same line as the Action and then it became a simple if statment without the ref. 

 

Thanks all for the ideas& help on this one! 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Since i could not get the ref to work i ended up doing the following

 

Adding two Index columns one starting with 0 the other with 1

 

Doing a merge table with itself and refrencing the two index columns. this shifted the time values to the same line as the Action and then it became a simple if statment without the ref. 

 

Thanks all for the ideas& help on this one! 

v-yuta-msft
Community Support
Community Support

Hi Frunkis,

 

You can use measure instead, try DAX below and check if it can meet your requirement:

 

Result =
VAR previous_time =
    CALCULATE (
        MAX ( ReportA06272018[Total Agents Needing Help] ),
        FILTER (
            ALL ( ReportA06272018 ),
            ReportA06272018[Index.1]
                = MAX ( ReportA06272018[Index.1] ) - 1
        )
    )
VAR previous_state =
    CALCULATE (
        MAX ( ReportA06272018[Action] ),
        FILTER (
            ALL ( ReportA06272018 ),
            ReportA06272018[Index.1]
                = MAX ( ReportA06272018[Index.1] ) - 1
        )
    )
RETURN
    IF (
        previous_state = "Release (Not Ready)",
        MAX ( ReportA06272018[Total Agents Needing Help] ) - previous_time
    )

Regards,

Jimmy Tao

Anonymous
Not applicable

So far I have gotten to 

 

= Table.AddColumn(#"Added Index1", "NotReady", each if [Action] = "Release (Not Ready) " then {[Index1]+1}[Time] else null)

 

This is not working and I am not sure why. Anyone have any pointers? 

Anonymous
Not applicable

I keep getting the following error with the above formula:

 

Expression.Error: We cannot apply field access to the type List.
Details:
Value=List
Key=Time

 

Any ideas on how to resolve this?

Anonymous
Not applicable

I have been using excel to do this function for a while and i can just have a formula that is "=if(c7='Release (Not Ready)', D8,0) and it works great. I am trying to make the change to Power BI because it offers alot of functions that Excel doesnt.. any help would be met with great enthusiasm. 

Anonymous
Not applicable

I do have an "Index" column that I added when trying to figure this out. It starts at a count of 1. 

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.