Replacing Foreign Key with Reference Name from other table in SSRS report












1















I am creating an SSRS matrix report in which Loans are mapped with primary keys of Employees originated the loan, so the tables looks like:






<table><tbody><tr><td>LoanID</td><td>Employee</td></tr><tr><td>101</td><td>1</td></tr><tr><td>102</td><td>2</td></tr><tr><td>103</td><td>3</td></tr><tr><td>104</td><td>2</td></tr><tr><td>105</td><td>1</td></tr><tr><td>106</td><td>2</td></tr></tbody></table>








<table><tbody><tr><td>Employeeid</td><td>Employee Name</td></tr><tr><td>1</td><td>A</td></tr><tr><td>2</td><td>B</td></tr><tr><td>3</td><td>C</td></tr></tbody></table>





When I create the matrix using first table I get:






<table><tbody><tr><td>Employee</td><td>Count Of Loans</td></tr><tr><td>1</td><td>2</td></tr><tr><td>2</td><td>3</td></tr><tr><td>3</td><td>1</td></tr></tbody></table>





But I wanted result like:






<table><tbody><tr><td>Employee</td><td>Count of Loans</td></tr><tr><td>A</td><td>2</td></tr><tr><td>B</td><td>3</td></tr><tr><td>C</td><td>1</td></tr></tbody></table>





How can I relate the name of values in rows groups to take out the names of Employees?










share|improve this question





























    1















    I am creating an SSRS matrix report in which Loans are mapped with primary keys of Employees originated the loan, so the tables looks like:






    <table><tbody><tr><td>LoanID</td><td>Employee</td></tr><tr><td>101</td><td>1</td></tr><tr><td>102</td><td>2</td></tr><tr><td>103</td><td>3</td></tr><tr><td>104</td><td>2</td></tr><tr><td>105</td><td>1</td></tr><tr><td>106</td><td>2</td></tr></tbody></table>








    <table><tbody><tr><td>Employeeid</td><td>Employee Name</td></tr><tr><td>1</td><td>A</td></tr><tr><td>2</td><td>B</td></tr><tr><td>3</td><td>C</td></tr></tbody></table>





    When I create the matrix using first table I get:






    <table><tbody><tr><td>Employee</td><td>Count Of Loans</td></tr><tr><td>1</td><td>2</td></tr><tr><td>2</td><td>3</td></tr><tr><td>3</td><td>1</td></tr></tbody></table>





    But I wanted result like:






    <table><tbody><tr><td>Employee</td><td>Count of Loans</td></tr><tr><td>A</td><td>2</td></tr><tr><td>B</td><td>3</td></tr><tr><td>C</td><td>1</td></tr></tbody></table>





    How can I relate the name of values in rows groups to take out the names of Employees?










    share|improve this question



























      1












      1








      1








      I am creating an SSRS matrix report in which Loans are mapped with primary keys of Employees originated the loan, so the tables looks like:






      <table><tbody><tr><td>LoanID</td><td>Employee</td></tr><tr><td>101</td><td>1</td></tr><tr><td>102</td><td>2</td></tr><tr><td>103</td><td>3</td></tr><tr><td>104</td><td>2</td></tr><tr><td>105</td><td>1</td></tr><tr><td>106</td><td>2</td></tr></tbody></table>








      <table><tbody><tr><td>Employeeid</td><td>Employee Name</td></tr><tr><td>1</td><td>A</td></tr><tr><td>2</td><td>B</td></tr><tr><td>3</td><td>C</td></tr></tbody></table>





      When I create the matrix using first table I get:






      <table><tbody><tr><td>Employee</td><td>Count Of Loans</td></tr><tr><td>1</td><td>2</td></tr><tr><td>2</td><td>3</td></tr><tr><td>3</td><td>1</td></tr></tbody></table>





      But I wanted result like:






      <table><tbody><tr><td>Employee</td><td>Count of Loans</td></tr><tr><td>A</td><td>2</td></tr><tr><td>B</td><td>3</td></tr><tr><td>C</td><td>1</td></tr></tbody></table>





      How can I relate the name of values in rows groups to take out the names of Employees?










      share|improve this question
















      I am creating an SSRS matrix report in which Loans are mapped with primary keys of Employees originated the loan, so the tables looks like:






      <table><tbody><tr><td>LoanID</td><td>Employee</td></tr><tr><td>101</td><td>1</td></tr><tr><td>102</td><td>2</td></tr><tr><td>103</td><td>3</td></tr><tr><td>104</td><td>2</td></tr><tr><td>105</td><td>1</td></tr><tr><td>106</td><td>2</td></tr></tbody></table>








      <table><tbody><tr><td>Employeeid</td><td>Employee Name</td></tr><tr><td>1</td><td>A</td></tr><tr><td>2</td><td>B</td></tr><tr><td>3</td><td>C</td></tr></tbody></table>





      When I create the matrix using first table I get:






      <table><tbody><tr><td>Employee</td><td>Count Of Loans</td></tr><tr><td>1</td><td>2</td></tr><tr><td>2</td><td>3</td></tr><tr><td>3</td><td>1</td></tr></tbody></table>





      But I wanted result like:






      <table><tbody><tr><td>Employee</td><td>Count of Loans</td></tr><tr><td>A</td><td>2</td></tr><tr><td>B</td><td>3</td></tr><tr><td>C</td><td>1</td></tr></tbody></table>





      How can I relate the name of values in rows groups to take out the names of Employees?






      <table><tbody><tr><td>LoanID</td><td>Employee</td></tr><tr><td>101</td><td>1</td></tr><tr><td>102</td><td>2</td></tr><tr><td>103</td><td>3</td></tr><tr><td>104</td><td>2</td></tr><tr><td>105</td><td>1</td></tr><tr><td>106</td><td>2</td></tr></tbody></table>





      <table><tbody><tr><td>LoanID</td><td>Employee</td></tr><tr><td>101</td><td>1</td></tr><tr><td>102</td><td>2</td></tr><tr><td>103</td><td>3</td></tr><tr><td>104</td><td>2</td></tr><tr><td>105</td><td>1</td></tr><tr><td>106</td><td>2</td></tr></tbody></table>





      <table><tbody><tr><td>Employeeid</td><td>Employee Name</td></tr><tr><td>1</td><td>A</td></tr><tr><td>2</td><td>B</td></tr><tr><td>3</td><td>C</td></tr></tbody></table>





      <table><tbody><tr><td>Employeeid</td><td>Employee Name</td></tr><tr><td>1</td><td>A</td></tr><tr><td>2</td><td>B</td></tr><tr><td>3</td><td>C</td></tr></tbody></table>





      <table><tbody><tr><td>Employee</td><td>Count Of Loans</td></tr><tr><td>1</td><td>2</td></tr><tr><td>2</td><td>3</td></tr><tr><td>3</td><td>1</td></tr></tbody></table>





      <table><tbody><tr><td>Employee</td><td>Count Of Loans</td></tr><tr><td>1</td><td>2</td></tr><tr><td>2</td><td>3</td></tr><tr><td>3</td><td>1</td></tr></tbody></table>





      <table><tbody><tr><td>Employee</td><td>Count of Loans</td></tr><tr><td>A</td><td>2</td></tr><tr><td>B</td><td>3</td></tr><tr><td>C</td><td>1</td></tr></tbody></table>





      <table><tbody><tr><td>Employee</td><td>Count of Loans</td></tr><tr><td>A</td><td>2</td></tr><tr><td>B</td><td>3</td></tr><tr><td>C</td><td>1</td></tr></tbody></table>






      reporting-services






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 25 '18 at 10:23







      Mayank Chhibber

















      asked Nov 25 '18 at 9:59









      Mayank ChhibberMayank Chhibber

      62




      62
























          1 Answer
          1






          active

          oldest

          votes


















          0














          It is generally better to join tables in the source system when you can. To answer your question, you can use the Lookup function to get the Employee Name from the second dataset. In this case it would look something like this:



          =Lookup(Fields!Employee.Value, Fields!EmployeeID.Value, Fields!EmployeeName.Value, "DataSet2")


          In other words, for each row, it is looking up the employee ID in the second dataset and returning the name.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53466411%2freplacing-foreign-key-with-reference-name-from-other-table-in-ssrs-report%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            It is generally better to join tables in the source system when you can. To answer your question, you can use the Lookup function to get the Employee Name from the second dataset. In this case it would look something like this:



            =Lookup(Fields!Employee.Value, Fields!EmployeeID.Value, Fields!EmployeeName.Value, "DataSet2")


            In other words, for each row, it is looking up the employee ID in the second dataset and returning the name.






            share|improve this answer




























              0














              It is generally better to join tables in the source system when you can. To answer your question, you can use the Lookup function to get the Employee Name from the second dataset. In this case it would look something like this:



              =Lookup(Fields!Employee.Value, Fields!EmployeeID.Value, Fields!EmployeeName.Value, "DataSet2")


              In other words, for each row, it is looking up the employee ID in the second dataset and returning the name.






              share|improve this answer


























                0












                0








                0







                It is generally better to join tables in the source system when you can. To answer your question, you can use the Lookup function to get the Employee Name from the second dataset. In this case it would look something like this:



                =Lookup(Fields!Employee.Value, Fields!EmployeeID.Value, Fields!EmployeeName.Value, "DataSet2")


                In other words, for each row, it is looking up the employee ID in the second dataset and returning the name.






                share|improve this answer













                It is generally better to join tables in the source system when you can. To answer your question, you can use the Lookup function to get the Employee Name from the second dataset. In this case it would look something like this:



                =Lookup(Fields!Employee.Value, Fields!EmployeeID.Value, Fields!EmployeeName.Value, "DataSet2")


                In other words, for each row, it is looking up the employee ID in the second dataset and returning the name.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 26 '18 at 21:46









                StevenWhiteStevenWhite

                4,51921136




                4,51921136
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53466411%2freplacing-foreign-key-with-reference-name-from-other-table-in-ssrs-report%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    404 Error Contact Form 7 ajax form submitting

                    How to know if a Active Directory user can login interactively

                    TypeError: fit_transform() missing 1 required positional argument: 'X'