Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
10 years ago
Solved

Sum (filter by same date)

Dear experts,

 

I would like to sum the sales by the same date in another table to calculate market share.

 

Example:

Posting Date     Sales

1 Jan 16            3

1 Jan 16            2

2 Jan 16            7

2 Jan 16            1

 

 

Date                  Market Sales            New Column

1 Jan 16            55                             Sales (3 + 2) / Market Sales (55)

2 Jan 16            60                             Sales (7 + 1) / Market Sales (60)

 

 

Appreciate your time to help. Thank you in advance,

 

  • Anonymous's avatar
    Anonymous
    10 years ago

    You add your measure in the Power BI desktop, not in the table. You right click and select new measure. After that, you will be able to change the name (by default it should write "measure") and enter the formula.

     

    Sébatien

  • Anonymous's avatar
    Anonymous
    10 years ago

    Anonymous if you want a monthly view you can:

     

    1) Create a calculated column (in the same table of the "NewColumn") to show the month.

     

    2) Then you can put "Month" and "NewColumn" into a visualization, and it automatically recalculate the value.

     

     

    #I'M Not An Expert#

  • Anonymous's avatar
    Anonymous
    10 years ago

    I've used the FORMAT() Function to show the month's name. If you want to display something else you can change the format (ex. "mmmm") using these.

8 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

     

       if you want I have another solution.

     

    1) You create a relation between the two tables

     

    2) After that you can create the calculated column (I put it in the "Sales" table because in the other I cannot use the RELATED() function)

     

    3) And you have your result.

     

    Also the Anonymous solution is valid. Choose the better option for your purpose.

    Let me know if it works.

     

    #I'M Not An Expert#

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi B129, I see your reply and thanks a lot for correcting my mistake. So my mistake is I am supposed to use related in the sales table.

       

      Then another question will be:

      In the example shown there is daily transaction (Sales) and daily market sales. How do I do it if I want to have monthly market share instead of daily market share?

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Anonymous if you want a monthly view you can:

         

        1) Create a calculated column (in the same table of the "NewColumn") to show the month.

         

        2) Then you can put "Month" and "NewColumn" into a visualization, and it automatically recalculate the value.

         

         

        #I'M Not An Expert#

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello Anonymous

     

    This may be a solution,

    First thing to do is to linked the table with the time dimension. So you should add a time table.

    Then you build your relationship like this :

     

    After this, you could build you new Measures in the desktop like this :

     

    Don't forget to wisely choose the column datetype (eg : Decimal number for new Measure, Integer with summary for Sales & Market Sales).

     

    Hope it help you

     

    Sébastien

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks Sebastien for replying. I would like to know where you include new measure? In the Table or in the power view.

      • Anonymous's avatar
        Anonymous
        Not applicable

        You add your measure in the Power BI desktop, not in the table. You right click and select new measure. After that, you will be able to change the name (by default it should write "measure") and enter the formula.

         

        Sébatien