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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
tmears
Helper III
Helper III

lookupvalue error

I wonder if anyone could help, really struggling on it..... 

 

ProfitAllocationRaw = IF(IF(Gates[Salesperson]="Sales Person 1",[S1Year]-Gates[QGate],[S2Year]-Gates[QGate])<0,0,IF(Gates[Salesperson]="Sales Person 1",[S1Year]-Gates[QGate]-(LOOKUPVALUE(Gates[QGate],Gates[GateNumber],Gates[GateNumber]-1)),[S2Year]-Gates[QGate]-(LOOKUPVALUE(Gates[QGate],Gates[GateNumber],Gates[GateNumber]-1))))

 

I am getting “A table of multiple values was supplied where a single value was expected.”, i am thinking it is an issue with the highlighted comma.  Any thoughts?

 

 

2 ACCEPTED SOLUTIONS
dedelman_clng
Community Champion
Community Champion

Hi @tmears  - 

 

There may be mulitple spots with issues in this code. Presuming that [ ] indicates measure and Table[ ] indicated column, everywhere that you have a measure minus a column will fail. You will need to do some kind of aggregation on the column (SUM, MIN, MAX, SELECTEDVALUE, RELATED, etc) to get a single value to subtract from the measure. Same with the third parameter in your LOOKUPVALUE clauses.

 

If you need more assistance, please share your pbix with sensitive data removed so we can see what the model and the data look like.

 

Hope this helps

David

View solution in original post

v-rzhou-msft
Community Support
Community Support

Hi @tmears 

Could you tell me if your problem has been solved? If it is, kindly Accept the helpful reply as the solution. More people will benefit from it. Or you are still confused about it, here I will gvie you some advice.

In addition to , the problem may be caused by lookupvalue function.

Your measure:

 

ProfitAllocationRaw =
IF (
    IF (
        Gates[Salesperson] = "Sales Person 1",
        [S1Year] - Gates[QGate],
        [S2Year] - Gates[QGate]
    ) < 0,
    0,
    IF (
        Gates[Salesperson] = "Sales Person 1",
        [S1Year] - Gates[QGate]
            - ( LOOKUPVALUE ( Gates[QGate], Gates[GateNumber], Gates[GateNumber] - 1 ) ),
        [S2Year] - Gates[QGate]
            - ( LOOKUPVALUE ( Gates[QGate], Gates[GateNumber], Gates[GateNumber] - 1 ) )
    )
)

 

In your false result, due to the lookupvalue, it may return to multiple values where Gate[GateNumber] = Gates[GateNumber]-1, so it comes to an error. 

Could you tell me your calculate logic, show me the result you want and provide me a data model like what you are dealing with?

Or you can share your pbix file with me by your OneDirve for Business.

 

Best Regards,

Rico Zhou

 

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

3 REPLIES 3
v-rzhou-msft
Community Support
Community Support

Hi @tmears 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,

Rico Zhou

v-rzhou-msft
Community Support
Community Support

Hi @tmears 

Could you tell me if your problem has been solved? If it is, kindly Accept the helpful reply as the solution. More people will benefit from it. Or you are still confused about it, here I will gvie you some advice.

In addition to , the problem may be caused by lookupvalue function.

Your measure:

 

ProfitAllocationRaw =
IF (
    IF (
        Gates[Salesperson] = "Sales Person 1",
        [S1Year] - Gates[QGate],
        [S2Year] - Gates[QGate]
    ) < 0,
    0,
    IF (
        Gates[Salesperson] = "Sales Person 1",
        [S1Year] - Gates[QGate]
            - ( LOOKUPVALUE ( Gates[QGate], Gates[GateNumber], Gates[GateNumber] - 1 ) ),
        [S2Year] - Gates[QGate]
            - ( LOOKUPVALUE ( Gates[QGate], Gates[GateNumber], Gates[GateNumber] - 1 ) )
    )
)

 

In your false result, due to the lookupvalue, it may return to multiple values where Gate[GateNumber] = Gates[GateNumber]-1, so it comes to an error. 

Could you tell me your calculate logic, show me the result you want and provide me a data model like what you are dealing with?

Or you can share your pbix file with me by your OneDirve for Business.

 

Best Regards,

Rico Zhou

 

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

dedelman_clng
Community Champion
Community Champion

Hi @tmears  - 

 

There may be mulitple spots with issues in this code. Presuming that [ ] indicates measure and Table[ ] indicated column, everywhere that you have a measure minus a column will fail. You will need to do some kind of aggregation on the column (SUM, MIN, MAX, SELECTEDVALUE, RELATED, etc) to get a single value to subtract from the measure. Same with the third parameter in your LOOKUPVALUE clauses.

 

If you need more assistance, please share your pbix with sensitive data removed so we can see what the model and the data look like.

 

Hope this helps

David

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.