cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Connor_Taylor
Resolver I
Resolver I

LookUp function only working sometimes

Hello,

 

I am using powerApps custom visual for power BI.


I have a function:

If(Not(IsBlank(LookUp(PowerBIIntegration.Data, Value = 39).Value)) ,NewForm(Form1);Navigate(Sub,ScreenTransition.Fade),If(Not(IsBlank(LookUp(PowerBIIntegration.Data, Value = 40).Value)),Navigate(Screen2,ScreenTransition.Fade),NewForm(EditForm1);Navigate(BrowseScreen1_1,ScreenTransition.Fade)))

Basically:
 - If the value is 39 THEN navigate to a form page
 - If the value is 40 THEN navigate to a different page
 - Else navigate to a different page

 

But this only works SOMETIMES, as if the conditional statements are ignored and navigates to the 'Else' page.

Anyway to fix this, or is this an issue?

 

Thank you

Related and previous post here

 
19 REPLIES 19
Drrickryp
Super User
Super User

Hi @Connor_Taylor,

  Please try

If(!IsBlank(LookUp(PowerBIIntegration.Data, Value=39)), Navigate(Sub,ScreenTransition.Fade); NewForm(Form1),
!IsBlank(LookUp(PowerBIIntegration.Data, Value=40)),Navigate(Screen2,ScreenTransition.Fade),NewForm(EditForm1),
Navigate(BrowseScreen1_1,ScreenTransition.Fade))

When formulas perform on an intermittent basis I am always suspicious that delegation is an issue.  I don't see an issue here though but if your datasource is >2000 items that may be a problem. 

 

Thanks for the reply @Drrickryp,

Tried using your formula, same issue, only works sometimes.

The datasource - which is powerbiintegration - only gives data that is < 2000 items.

 

This seems like an issue with the power BI integration/custom visual

Hi @Connor_Taylor,

As an experiment, create a collection from your datasource and substitute that into your formula. That could be a way to test your theory. If it works consistently, then the problem is in the connector and not your formula.

Hi @Drrickryp,

 

I created a collection

Collect( TheData, { ColValue: PowerBIIntegration.Data.Value})

Only containing the value column since its the only column checked.

 

But now my formula is telling me invalid argument type on the '=' operation

If(!IsBlank(LookUp(TheData, ColValue=39)), Navigate(Sub,ScreenTransition.Fade); NewForm(Form1),
!IsBlank(LookUp(TheData, ColValue=40)),Navigate(Screen2,ScreenTransition.Fade),NewForm(EditForm1),
Navigate(BrowseScreen1_1,ScreenTransition.Fade))

Is the collection saving 'Value' as text?

Do you know how I can fix this?

Yep, if the error is saying one side is text and the other side is numeric multiply the text side *1. PowerApps then assumes its a number.

Hi @Drrickryp,

Multiplying the 'ColValue' by 1 gives an error.
'Invalid argument type. Expecting one of the following: Number, Text, Boolean'

 

LookUp(TheData, ColValue * 1 =40)

Is there something incorrect about how I've created the column value in the above reply?

Thanks for your help

Just wedging in here to galavant through the room, waving my "LookUps don't always work" banner like a maniac.

 

Really.

 

I sat on a Skype call with 3rd level support from Microsoft. Had him look at my data and my formula. He agreed that there was nothing wrong with the formula and that the data really was there. LookUp should have been returning something.

 

His suggestion has worked for me in all cases since:

Instead of a LookUp() formula, use a First(Filter()).field construction.

 

So if your LookUp was:

LookUp(yourDataSource, yourTestField = 40, yourReturnField)

 

...it would become:

First(Filter(yourDataSource, yourTestField = 40)).yourReturnField

 

...and the banner-waving maniac exits the room...

@TimRohr,

Well I'll be darned.  Thats the first I have heard of it.  @Connor_Taylor, give it a shot and see if it works. 

Hi @TimRohr,

Interesting point, It's worth a shot.

 

If(!IsBlank(LookUp(PowerBIIntegration.Data, Value=39)), Navigate(Sub,ScreenTransition.Fade); NewForm(Form1),
!IsBlank(LookUp(PowerBIIntegration.Data, Value=40)),Navigate(Screen2,ScreenTransition.Fade),NewForm(EditForm1),
Navigate(BrowseScreen1_1,ScreenTransition.Fade))

What would the above formula look like using First(Filter... instead?

 

I have attempted to recreate it as:

If(!IsBlank(First(Filter(PowerBIIntegration.Data, Value=39))), 
        Navigate(Sub,ScreenTransition.Fade); NewForm(Form1),
    !IsBlank(First(Filter(PowerBIIntegration.Data, Value=40))),
        Navigate(Screen2,ScreenTransition.Fade),NewForm(EditForm1),
Navigate(BrowseScreen1_1,ScreenTransition.Fade))

But this doesn't work as intended

Any help appreciated,

Thanks

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,389)