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
santossssshhh
Frequent Visitor

get total value at the bottom after applying if condition to our column

I am working on a trial balance report where i have values like opening debit and credit, periodic debit and credit and closing debit and credit. While calculatinng opening debit and credit, I use a condition - if(debit > credit, debit - credit,0) for debit column and 

if(credit > debit, credit - debit,0). It works well for the above rows, but I don't get total sum of these values at the bottom. I need the total values at the bottom. I've searched all over the internet but couldn't find it. 
Is there anyone to help me with this???

3 REPLIES 3
parry2k
Super User
Super User

@santossssshhh provide more details, how your data model looks like? What you are using on the rows. Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@santossssshhh change your measure to this:

 

SUMX ( VALUES ( YourTable[ColumnOnRow] ),
if(credit > debit, credit - debit,0)
)


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

It doesn't work. Have a look on my table. It compares the first two columns and uses the formula for finding greater value and subtracting. I need the sum of all the rows compared. problem.png

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.

Top Kudoed Authors