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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PavaniD
Helper I
Helper I

Calculate Sum of one column

Hello

 

I have a report which needs total for one amount column.when I select sum by right clicking on the column name,its giving me wrong result.
Sum for this is $3109.01

PavaniD_0-1712319493071.png

But im getting this

PavaniD_1-1712319581731.png

 

5 REPLIES 5
v-zhengdxu-msft
Community Support
Community Support

Hi @PavaniD 

 

Thanks for the reply from @3CloudThomas , please allow me to provide another insight:
First of all, I create a set of sample:

vzhengdxumsft_0-1712540947681.png

You can use the if() and Hasonevalue() function to calculate the total separately:

MEASURE =
IF (
    HASONEVALUE ( 'Table'[ID] ),
    SUM ( 'Table'[Value] ),
    IF (
        SUMX ( ALLSELECTED ( 'Table' ), 'Table'[Value] ) > 0,
        SUMX ( ALLSELECTED ( 'Table' ), 'Table'[Value] ),
        0
    )
)

 The result is as follow:

vzhengdxumsft_1-1712541077344.pngvzhengdxumsft_2-1712541088510.png

When the sum of the value less than 0 then return 0.

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Its still the same.sum of current amount is the measure i used that you suggested.

PavaniD_0-1712746705002.png

 

Hi @PavaniD 

 

Could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

PavaniD
Helper I
Helper I

I tried the above measure.But Im getting wrong result.

PavaniD_0-1712322431670.png

Here ($1,126.98) is actually "-$1,126.98" negative amount.So the ressult must be 0.

3CloudThomas
Super User
Super User

Do not right-click and select sum.
Create an explicit measure Sum Current Amt = SUM(<tablename'>Current Amt')
Please this measure, Sum Curent Amt, in the table with the attributes to sum.
You might even want to turn Auto Sum off on the columns in the model.

Explicit Vs Implicit DAX Measures in Power BI - RADACAD

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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