dax handling summary values in a matrix report









up vote
0
down vote

favorite












Source data columns are Store, Product, StoreSales, and ProductSales



StoreSales has duplicate values, even across different Stores.



Looking for a dax measure to handle StoreSales as described in the image.



This is the closest so far, but doesn't account for duplicates between stores.



Store Sales:=
sumx(DISTINCT(_Sales[StoreSales), _Sales[StoreSales])



screenshot of source and pivot table
enter image description here










share|improve this question



























    up vote
    0
    down vote

    favorite












    Source data columns are Store, Product, StoreSales, and ProductSales



    StoreSales has duplicate values, even across different Stores.



    Looking for a dax measure to handle StoreSales as described in the image.



    This is the closest so far, but doesn't account for duplicates between stores.



    Store Sales:=
    sumx(DISTINCT(_Sales[StoreSales), _Sales[StoreSales])



    screenshot of source and pivot table
    enter image description here










    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Source data columns are Store, Product, StoreSales, and ProductSales



      StoreSales has duplicate values, even across different Stores.



      Looking for a dax measure to handle StoreSales as described in the image.



      This is the closest so far, but doesn't account for duplicates between stores.



      Store Sales:=
      sumx(DISTINCT(_Sales[StoreSales), _Sales[StoreSales])



      screenshot of source and pivot table
      enter image description here










      share|improve this question















      Source data columns are Store, Product, StoreSales, and ProductSales



      StoreSales has duplicate values, even across different Stores.



      Looking for a dax measure to handle StoreSales as described in the image.



      This is the closest so far, but doesn't account for duplicates between stores.



      Store Sales:=
      sumx(DISTINCT(_Sales[StoreSales), _Sales[StoreSales])



      screenshot of source and pivot table
      enter image description here







      dax ssas-tabular






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 11 at 21:54









      RADO

      2,6732614




      2,6732614










      asked Nov 11 at 17:42









      user5050939

      32




      32






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          To answer your question directly, this formula should give you the desired result:



          Desired Result for Store Sales = 
          IF(ISFILTERED(_Sales[Store]), SUM(_Store[Store Sales]))


          However, I recommend to revisit your data model design. It's conceptually incorrect (you are mixing detailed data with the summary of the same data), and you will have serious problems with DAX. A better way to structure your data:



          • Remove column "Store Sales". It's redundant and does not fit the data level of detail.

          • Rename column "Product Sales" into "Sale Amount". It's just sale amount, without any qualifiers.

          • Create a measure "Total Sales" = SUM(_Sales[Sale Amount]). It will correctly calculate total sales both on product and store levels.

          If you need a special measure for store sales, use SUMX:



          Store-level sales = SUMX (VALUES(_Sales[Store]), [Total Sales])


          And if you need to show product contributions to store sales:



          Product Contribution = `DIVIDE([Total Sales], [Store-Level Sales])





          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',
            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%2f53251456%2fdax-handling-summary-values-in-a-matrix-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








            up vote
            1
            down vote



            accepted










            To answer your question directly, this formula should give you the desired result:



            Desired Result for Store Sales = 
            IF(ISFILTERED(_Sales[Store]), SUM(_Store[Store Sales]))


            However, I recommend to revisit your data model design. It's conceptually incorrect (you are mixing detailed data with the summary of the same data), and you will have serious problems with DAX. A better way to structure your data:



            • Remove column "Store Sales". It's redundant and does not fit the data level of detail.

            • Rename column "Product Sales" into "Sale Amount". It's just sale amount, without any qualifiers.

            • Create a measure "Total Sales" = SUM(_Sales[Sale Amount]). It will correctly calculate total sales both on product and store levels.

            If you need a special measure for store sales, use SUMX:



            Store-level sales = SUMX (VALUES(_Sales[Store]), [Total Sales])


            And if you need to show product contributions to store sales:



            Product Contribution = `DIVIDE([Total Sales], [Store-Level Sales])





            share|improve this answer
























              up vote
              1
              down vote



              accepted










              To answer your question directly, this formula should give you the desired result:



              Desired Result for Store Sales = 
              IF(ISFILTERED(_Sales[Store]), SUM(_Store[Store Sales]))


              However, I recommend to revisit your data model design. It's conceptually incorrect (you are mixing detailed data with the summary of the same data), and you will have serious problems with DAX. A better way to structure your data:



              • Remove column "Store Sales". It's redundant and does not fit the data level of detail.

              • Rename column "Product Sales" into "Sale Amount". It's just sale amount, without any qualifiers.

              • Create a measure "Total Sales" = SUM(_Sales[Sale Amount]). It will correctly calculate total sales both on product and store levels.

              If you need a special measure for store sales, use SUMX:



              Store-level sales = SUMX (VALUES(_Sales[Store]), [Total Sales])


              And if you need to show product contributions to store sales:



              Product Contribution = `DIVIDE([Total Sales], [Store-Level Sales])





              share|improve this answer






















                up vote
                1
                down vote



                accepted







                up vote
                1
                down vote



                accepted






                To answer your question directly, this formula should give you the desired result:



                Desired Result for Store Sales = 
                IF(ISFILTERED(_Sales[Store]), SUM(_Store[Store Sales]))


                However, I recommend to revisit your data model design. It's conceptually incorrect (you are mixing detailed data with the summary of the same data), and you will have serious problems with DAX. A better way to structure your data:



                • Remove column "Store Sales". It's redundant and does not fit the data level of detail.

                • Rename column "Product Sales" into "Sale Amount". It's just sale amount, without any qualifiers.

                • Create a measure "Total Sales" = SUM(_Sales[Sale Amount]). It will correctly calculate total sales both on product and store levels.

                If you need a special measure for store sales, use SUMX:



                Store-level sales = SUMX (VALUES(_Sales[Store]), [Total Sales])


                And if you need to show product contributions to store sales:



                Product Contribution = `DIVIDE([Total Sales], [Store-Level Sales])





                share|improve this answer












                To answer your question directly, this formula should give you the desired result:



                Desired Result for Store Sales = 
                IF(ISFILTERED(_Sales[Store]), SUM(_Store[Store Sales]))


                However, I recommend to revisit your data model design. It's conceptually incorrect (you are mixing detailed data with the summary of the same data), and you will have serious problems with DAX. A better way to structure your data:



                • Remove column "Store Sales". It's redundant and does not fit the data level of detail.

                • Rename column "Product Sales" into "Sale Amount". It's just sale amount, without any qualifiers.

                • Create a measure "Total Sales" = SUM(_Sales[Sale Amount]). It will correctly calculate total sales both on product and store levels.

                If you need a special measure for store sales, use SUMX:



                Store-level sales = SUMX (VALUES(_Sales[Store]), [Total Sales])


                And if you need to show product contributions to store sales:



                Product Contribution = `DIVIDE([Total Sales], [Store-Level Sales])






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 11 at 22:25









                RADO

                2,6732614




                2,6732614



























                    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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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%2f53251456%2fdax-handling-summary-values-in-a-matrix-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







                    這個網誌中的熱門文章

                    Barbados

                    How to read a connectionString WITH PROVIDER in .NET Core?

                    Node.js Script on GitHub Pages or Amazon S3