web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Global Variable contai...
Power Apps
Answered

Global Variable containing Excel Data Source is different type from other Excel Data Sources

(0) ShareShare
ReportReport
Posted on by 14

Hello,

I had written this line of code

 

Switch(
 Package,
 "PO",
 Set(SelectedDataSource,tbl_P4_Scorecard),
 "UO",
 Set(SelectedDataSource,tbl_U4_Scorecard),
 "XP",
 Set(SelectedDataSource,tbl_X4_Scorecard),
 "EW",
 Set(SelectedDataSource,tbl_EW_Scorecard),
 "CR",
 Set(SelectedDataSource,tbl_E4_Scorecard),
 "E4",
 Set(SelectedDataSource,tbl_E4_Scorecard)
)

 

 Now, this switch worked correctly. Then, unfortunately, we had to delete one of the documents, and upload a new one.

We deleted the document, we deleted the data source, and recreated the data source with the new document.

Now, whenever I insert the new table, I am given this error:

JonathanGiunta9_0-1693396732487.png

("Incompatible type. We can't evaluate your formula because the context variable types are incompatible with the types of values in other places in your app")

I have identified that it is indeed the "new document" creating this issue, as when i assign it to a new variable, there is no issue.

The issue stands from this: the tables are identical, in rows number and in columns. 

If i assign it to another variable, i can see that the type of the variable is "Table" as are the other ones.

JonathanGiunta9_1-1693396956420.png

 

This is the only place where I assign the value to "Selected Data Source".

 

If i remove this line, everything works fine.

 

I don't know where the problem could be...

 

Categories:
  • gcmfaizan Profile Picture
    1,022 on at

    @JonathanGiunta9 if you are getting the error while using the set function, try ClearCollect function something like this:

    ClearCollect(SelectedDataSource, {});
    Switch(
     Package,
     "PO",
     ClearCollect(SelectedDataSource, tbl_P4_Scorecard),
     "UO",
     ClearCollect(SelectedDataSource, tbl_U4_Scorecard),
     "XP",
     ClearCollect(SelectedDataSource, tbl_X4_Scorecard),
     "EW",
     ClearCollect(SelectedDataSource, tbl_EW_Scorecard),
     "CR",
     ClearCollect(SelectedDataSource, tbl_E4_Scorecard),
     "E4",
     ClearCollect(SelectedDataSource, tbl_E4_Scorecard)
    )

     

    I hope it works.

     

    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

     

    Thanks!

  • JonathanGiunta9 Profile Picture
    14 on at

    Hello @gcmfaizan ,

     

    Thank you for your suggestion, but it appears the problem is affecting the proposed resolution.

    JonathanGiunta9_0-1693397958332.png

    I think it still has to do with the fact that it's not being recognized as the same type as the other 5.

     

  • Verified answer
    JonathanGiunta9 Profile Picture
    14 on at

    Quick reply to update:

     

    The issue was the format of a column in the excel file.

    We copied the format of the whole sheet of one of the working Excels, and pasted into the sheet containing the "corrupted" table, and from then, it worked.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard