Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
cho
Helper I
Helper I

Getting summation of Month to Date column

Hi Experts,

 

This is a long and complicated question.

I have a table (Account) with Date, Business, Site ID and Sales. There are multiple Site IDs for one Business. And I have a calendar table with Dates (Date). I need to take cumulative daily sales by site ID for a month. That is, month-to-date values. Similar thing should be done to quarter-to-date, but I will start with month-to-date.

 

So I added a measure:

 

MTD Sales = TOTALMTD(SUM(Account[Sales]),Date[DATE])

 

 

But, finance team needs to see all figures in (+). Since there are (-) values, I modified the measure to get all values as positives.

 

MTD Sales (+)= IF(TOTALMTD(SUM(Account[Sales]),Date[DATE])<0,TOTALMTD(SUM(Account[Sales]),Date[DATE])*(-1),TOTALMTD(SUM(Account[Sales]),Date[DATE]))

 

 

Then I get the required results on Site ID level. But when it comes to Business level, I need to get the summation of 'MTD Sales' on Site ID level. But what Power BI does is, apply the same logic for Business level as well.

Unforetunately this forum does not allow me to attach my pbix file. But to make things clear, Pls refere below tables.

 

This table contains the summarized version on Site ID level. I created a table visual based on my measures. This gives required result.

 

BusinessSite IDDateSalesMTD SalesMTD Sales (+)
RnDABC1/3/2023                   (167)                                (167)                      167
RnDABC1/4/2023                      (42)                                (209)                      209
RnDABC1/5/2023                   (183)                                (392)                      392
RnDABC1/6/2023                      (48)                                (440)                      440
RnDABC1/7/2023                     450                                    10                        10
RnDABC1/9/2023                     411                                 421                      421
RnDABC1/10/2023                   (754)                                (333)                      333
RnDABC1/11/2023                     411                                    78                        78
RnDABC1/31/2023                     556                                 634                      634
RnDXYZ1/4/2023                   (920)                                (286)                      286
RnDXYZ1/5/2023                  1,312                              1,026                  1,026
RnDXYZ1/6/2023                   (920)                                 106                      106
RnDXYZ1/7/2023                  1,312                              1,418                  1,418
RnDXYZ1/9/2023                   (920)                                 498                      498
RnDXYZ1/30/2023                  1,526                              2,024                  2,024
RnDXYZ1/31/2023                   (920)                              1,104                  1,104

 

But when I get a visual on Business level I get this:

BusinessDateSalesMTD SalesMTD Sales (+)
RnD1/3/2023         (167)         (167)          167
RnD1/4/2023         (962)     (1,129)       1,129
RnD1/5/2023       1,129             -               -  
RnD1/6/2023         (968)         (968)          968
RnD1/7/2023       1,762          794          794
RnD1/9/2023         (509)          285          285
RnD1/10/2023         (754)         (469)          469
RnD1/11/2023          411           (58)            58
RnD1/30/2023       1,526       1,468       1,468
RnD1/31/2023         (364)       1,104       1,104

 

 

I know PowerBI does the correct thing. But I want the total of Site ID level figures on my Business level table like this:

BusinessDateSalesMTD SalesMTD Sales (+)
RnD1/3/2023         (167)         (167)          167
RnD1/4/2023         (495)         (662)          662
RnD1/5/2023          634           (28)            28
RnD1/6/2023         (334)         (362)          362
RnD1/7/2023       1,428       1,066       1,066
RnD1/9/2023          919       1,985       1,985
RnD1/10/2023         (333)       1,652       1,652
RnD1/11/2023            78       1,730       1,730
RnD1/30/2023       2,024       3,754       3,754
RnD1/31/2023       1,738       5,492       5,492

 

Can someone please help me. Hope this is clear.

2 REPLIES 2
Sahir_Maharaj
Super User
Super User

Hello @cho,

 

To get the total of Site ID level figures on your Business level table, you can modify the MTD Sales (+) measure to take the sum of MTD Sales (+) at the site ID level and then take the absolute value of the result.

 

MTD Sales (+) Business Level = ABS(SUMX(Account, [MTD Sales (+)]))

 

This measure will sum the MTD Sales (+) values for each Site ID and then take the absolute value of the result. When you use this measure in your Business level table, it should show the correct totals.

 

Let me know if you may require further guidance.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Thank you @Sahir_Maharaj. Unforetunately this gives me a huge value which is incorrect. I changed your equation to below and tried as well. Then it gives a lower value.

 

 

MTD Sales (+) Business Level = ABS(SUMX(Account, [MTD Sales]))

 

But your example SUMX() gave me another idea. Is it possible to use ameasure based on SUMX() at the beginning without MTD Sales or MTD Sales (+)? So we do not need many measures.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors