Forum Discussion
SUM function doing wrongly calculation
Hi Community..!!
Find below screenshot for your information.
@@test is measure name, Day column is coming from calendar table and Tot service value gross coming from order level table, both the table connected using calendar_sk column.
I need to show sum of total service value gross in the column chart, but calculation showing wrong result. I am taking date to the x-axis and measure to y axis.
Kindly help me to resolve this.
Hi All, Thank you so much for all your inputs and suggestions, my issue has been resolved by simple SUM fucntion, issue was in the data not in the DAX.
Once again thank you so much for your kind help..!!😊
11 Replies
- rohit1991Super User
Hii prasadpatil020
The SUM function is not calculating wrongly it’s working row by row because your measure is evaluated at the day level, and each row already contains the final value for that day. When you place Day on the axis, Power BI shows the measure per day, but when you put it in a column chart, the measure still returns the per-day value instead of the total. To get the full total across all days, you must create a measure like Total Service = SUM(‘OrderTable’[Tot Service Value Gross]) and use that in the visual without Day on the axis. If you keep Day on the axis, Power BI will always show the daily value, not the grand total.
- prasadpatil020Helper I
Hi rohit1991 ,
Thanks for the quick reply but that is my requirement , i need to keep date field on the x-axis.- rohit1991Super User
Hii prasadpatil020
If you must keep the Date on the x-axis, then the SUM will always show the daily value, not the total. In that case you need a separate measure that ignores the day context, for example:
Total Service (Ignore Date) = CALCULATE(SUM('OrderTable'[Tot Service Value Gross]), ALL('Calendar')).
This removes the day filter so the column chart will show the full total even when Date is on the axis.
- Jaywant-ThoratSuper User
If you want precise help, share two things
The exact DAX for @@test (so I can review it).
A screenshot of the Model view showing the relationship between your Calendar and Orders.
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Jaywant Thorat | MCT | Data Analytics Coach
Linkedin: https: https://www.linkedin.com/in/jaywantthorat/#MissionPowerBIBharat = https://shorturl.at/5ViW9
- prasadpatil020Helper I
Hi Jaywant-Thorat
measure is just i am usingSUM('Order Level Details'[Tot. Service Value Gross])
Calendar table and order level table are connected via calendar_sk and relation is one-many single direction.
- prasadpatil020Helper I
Hi All, Thank you so much for all your inputs and suggestions, my issue has been resolved by simple SUM fucntion, issue was in the data not in the DAX.
Once again thank you so much for your kind help..!!😊