Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

SUM by dates

 

Hello,

 

I need to create a bar chart that SUMS all pump durations based on a single date. Sorting by multiple values on the x-axis of the bar chart would solve my problem, but I dont believe I can do that. So please help me forumate a new column.

 

The day 2 date is correlated with the day 2 pump duration, and then needs to be matched and added to the day 1 date and durations.

 

Feb. 24th should come out to 4.33

Feb 25th = 17.97

Feb 26th = 6.94

 

Thanks for your help,

 

Jace

3 Replies

  • TeigeGao's avatar
    TeigeGao
    Solution Sage

    Hi Anonymous ,

    According to your description, my understanding is that you want to sum the data of day 1 and day 2, in this scenario, we can first create a calculated table with the following DAX query:

    Table =
    UNION (
        SUMMARIZE (
            Table1,
            Table1[Day 1 Date],
            "Total", SUM ( Table1[Day 1 Pump Duration] )
        ),
        SUMMARIZE (
            Table1,
            Table1[Day 2 Date],
            "Total", SUM ( Table1[Day 2 Pump Duration] )
        )
    )

    The result will like below:

    Then we can drag these two columns to bar chart(I just use some part of the sample data):

    Best Regards,

    Teige

    • Anonymous's avatar
      Anonymous
      Not applicable

      TeigeGao ,

       

      Thankyou very much, your solution worked for me, but I am running into a further issue that I forgot about.

       

      I need to filter/sort by the id. Please see below and thanks for your time.