Date from multiple date columns










1















I am using Tableau and I would like to combine two different date columns
1. purchase_date
2. revenue_date



My case is that there is a delay between purchase creation date and revenue creation date. We sell products and we take the revenue a few days later.



We would like to have a field that the amount dimension to be calculated using revenue date and the number of purchases dimension to be calculation using purchase date. So the desired result is the one displayed below (Expected Tableau result).
Exptected tableau example










share|improve this question






















  • Are you using the Tableau API to write code to do this? If so, show your Minimal, Complete, and Verifiable example. Otherwise, it is likely off-topic for SO.

    – jdv
    Nov 14 '18 at 17:27











  • Sounds like you a mixing cash basis and accrual basis views of the data

    – Alex Blakemore
    Nov 14 '18 at 17:29















1















I am using Tableau and I would like to combine two different date columns
1. purchase_date
2. revenue_date



My case is that there is a delay between purchase creation date and revenue creation date. We sell products and we take the revenue a few days later.



We would like to have a field that the amount dimension to be calculated using revenue date and the number of purchases dimension to be calculation using purchase date. So the desired result is the one displayed below (Expected Tableau result).
Exptected tableau example










share|improve this question






















  • Are you using the Tableau API to write code to do this? If so, show your Minimal, Complete, and Verifiable example. Otherwise, it is likely off-topic for SO.

    – jdv
    Nov 14 '18 at 17:27











  • Sounds like you a mixing cash basis and accrual basis views of the data

    – Alex Blakemore
    Nov 14 '18 at 17:29













1












1








1








I am using Tableau and I would like to combine two different date columns
1. purchase_date
2. revenue_date



My case is that there is a delay between purchase creation date and revenue creation date. We sell products and we take the revenue a few days later.



We would like to have a field that the amount dimension to be calculated using revenue date and the number of purchases dimension to be calculation using purchase date. So the desired result is the one displayed below (Expected Tableau result).
Exptected tableau example










share|improve this question














I am using Tableau and I would like to combine two different date columns
1. purchase_date
2. revenue_date



My case is that there is a delay between purchase creation date and revenue creation date. We sell products and we take the revenue a few days later.



We would like to have a field that the amount dimension to be calculated using revenue date and the number of purchases dimension to be calculation using purchase date. So the desired result is the one displayed below (Expected Tableau result).
Exptected tableau example







tableau






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 14 '18 at 17:18









George KaloskopisGeorge Kaloskopis

61




61












  • Are you using the Tableau API to write code to do this? If so, show your Minimal, Complete, and Verifiable example. Otherwise, it is likely off-topic for SO.

    – jdv
    Nov 14 '18 at 17:27











  • Sounds like you a mixing cash basis and accrual basis views of the data

    – Alex Blakemore
    Nov 14 '18 at 17:29

















  • Are you using the Tableau API to write code to do this? If so, show your Minimal, Complete, and Verifiable example. Otherwise, it is likely off-topic for SO.

    – jdv
    Nov 14 '18 at 17:27











  • Sounds like you a mixing cash basis and accrual basis views of the data

    – Alex Blakemore
    Nov 14 '18 at 17:29
















Are you using the Tableau API to write code to do this? If so, show your Minimal, Complete, and Verifiable example. Otherwise, it is likely off-topic for SO.

– jdv
Nov 14 '18 at 17:27





Are you using the Tableau API to write code to do this? If so, show your Minimal, Complete, and Verifiable example. Otherwise, it is likely off-topic for SO.

– jdv
Nov 14 '18 at 17:27













Sounds like you a mixing cash basis and accrual basis views of the data

– Alex Blakemore
Nov 14 '18 at 17:29





Sounds like you a mixing cash basis and accrual basis views of the data

– Alex Blakemore
Nov 14 '18 at 17:29












1 Answer
1






active

oldest

votes


















0














This task would be easier if you reshape your data (or revise your query) to have two tables. The first describing Orders_Placed with a Purchase Id and Date and Amount Columns



The second table describing Received_Payments with Payment_Id, Order_Id, Date and Amount columns.



If you model your data separately in this case, you can represent situations like - orders that have no payments yet, orders that have a series of partial payments, even overpayments. So there are benefits to not mixing two different types of objects in your data representation. And payments are still tied to orders by the shared Order_Id



Finally, to get the chart you want, you can make two separate connections in Tableau and then use data blending to build your chart. Linking on the date field. Use the Order data source as the primary data source.






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%2f53305583%2fdate-from-multiple-date-columns%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














    This task would be easier if you reshape your data (or revise your query) to have two tables. The first describing Orders_Placed with a Purchase Id and Date and Amount Columns



    The second table describing Received_Payments with Payment_Id, Order_Id, Date and Amount columns.



    If you model your data separately in this case, you can represent situations like - orders that have no payments yet, orders that have a series of partial payments, even overpayments. So there are benefits to not mixing two different types of objects in your data representation. And payments are still tied to orders by the shared Order_Id



    Finally, to get the chart you want, you can make two separate connections in Tableau and then use data blending to build your chart. Linking on the date field. Use the Order data source as the primary data source.






    share|improve this answer





























      0














      This task would be easier if you reshape your data (or revise your query) to have two tables. The first describing Orders_Placed with a Purchase Id and Date and Amount Columns



      The second table describing Received_Payments with Payment_Id, Order_Id, Date and Amount columns.



      If you model your data separately in this case, you can represent situations like - orders that have no payments yet, orders that have a series of partial payments, even overpayments. So there are benefits to not mixing two different types of objects in your data representation. And payments are still tied to orders by the shared Order_Id



      Finally, to get the chart you want, you can make two separate connections in Tableau and then use data blending to build your chart. Linking on the date field. Use the Order data source as the primary data source.






      share|improve this answer



























        0












        0








        0







        This task would be easier if you reshape your data (or revise your query) to have two tables. The first describing Orders_Placed with a Purchase Id and Date and Amount Columns



        The second table describing Received_Payments with Payment_Id, Order_Id, Date and Amount columns.



        If you model your data separately in this case, you can represent situations like - orders that have no payments yet, orders that have a series of partial payments, even overpayments. So there are benefits to not mixing two different types of objects in your data representation. And payments are still tied to orders by the shared Order_Id



        Finally, to get the chart you want, you can make two separate connections in Tableau and then use data blending to build your chart. Linking on the date field. Use the Order data source as the primary data source.






        share|improve this answer















        This task would be easier if you reshape your data (or revise your query) to have two tables. The first describing Orders_Placed with a Purchase Id and Date and Amount Columns



        The second table describing Received_Payments with Payment_Id, Order_Id, Date and Amount columns.



        If you model your data separately in this case, you can represent situations like - orders that have no payments yet, orders that have a series of partial payments, even overpayments. So there are benefits to not mixing two different types of objects in your data representation. And payments are still tied to orders by the shared Order_Id



        Finally, to get the chart you want, you can make two separate connections in Tableau and then use data blending to build your chart. Linking on the date field. Use the Order data source as the primary data source.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 14 '18 at 18:03

























        answered Nov 14 '18 at 17:33









        Alex BlakemoreAlex Blakemore

        8,30421840




        8,30421840





























            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%2f53305583%2fdate-from-multiple-date-columns%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







            這個網誌中的熱門文章

            What does pagestruct do in Eviews?

            Dutch intervention in Lombok and Karangasem

            Channel Islands