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 / join two sql tables
Power Apps
Answered

join two sql tables

(0) ShareShare
ReportReport
Posted on by 42

I have two basic sql tables I need to join so I can display the data for each on the same line graph.

I can make seperate line graphs of each table seperately with date on the x and number on the Y. I simply want the date on the botom and number on the Y axis with a different line for each subscribed and unsubscribed

 

my two tables are subscription and unsubscribe. I'd like the result to be the simple joined

 

sub.JPG    unsub.JPG   join.JPG
I think my solution lies in thes answer but I can't get it right.

https://powerusers.microsoft.com/t5/General-Discussion/Syntax-for-joining-tables/td-p/61387

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @ahall 

     

    You can try as follows:

     

     

    ClearCollect(myCollection, ShowColumns(AddColumns('Subscription Table', "UnsubscribeNumber", 
    Value(LookUp('UnSubscribe Table',
    Text(subdate, "[$-en-US]dd/mm/yyyy") = Text(unsubdate, "[$-en-US]dd/mm/yyyy"), unsubnumber))),
    "subdate", "subnumber", "UnsubscribeNumber"))

    By using Value function, if unsubscribednumber is not available for given date you will get 0. 

     

    Based on the output place a line graph, with Items property as myCollection and set "Number of Series" to 2 (to see 2 line graphs)

     

    Thanks.

     

     

     

     

  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @ahall ,

     

    The issue you have is that the ‘unsubscribedNumber’ column have no value in the joined table, right?

    What is the type of ‘date’ column, DateTime?

     

    I have made a test on my side, and find the issue may be due to the ‘date’ column, the date type column is unable to match successfully in LookUp.

    Here is two workarounds.

    1. Use text or value function to convert date to text/value, so that they can join successfully. But delegation should notice.

    You can refer to the formula:

    ClearCollect(myCollection,AddColumns('[dbo].[Subscription Table]',"unsubscribedNumber",LookUp('[dbo].[Unsub Table]',Text(date,DateTimeFormat.ShortDate)=Text('[dbo].[Subscription Table]'[@date],DateTimeFormat.ShortDate),unsubscribedNumber)))

    Annotation 2019-08-27 110909.png

    2. Or you can add another index column (Text/Value type), and use it to match in LookUp instead of ‘data’ column, so that there is no need to worry about the delegation warning.

     

    Best regards,

    Sik

  • ahall Profile Picture
    42 on at

    thanks so much, basically the same as the other answer I was able to omit the ShowColumn.

  • ahall Profile Picture
    42 on at

    thanks, I was able to make it work. I might be best to add a third column with just a text representation of date as I don't need a real date object.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard