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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
LB-Tech
Helper I
Helper I

I need a DAX for my output column

Hello,
I Need the measure for the Output column value. I have mentioned the calculation logic for the output column. Note: For months December, January, February 2024 i have no credit and debit , so it should be blank.

Post 3.jpg

2 ACCEPTED SOLUTIONS
v-denglli-msft
Community Support
Community Support

Thanks for the reply from rajendraongole1, please allow me to provide another insight.
Hi @LB-Tech ,

Please try the following DAX.

Output = 
 VAR _tb = FILTER(ALL('Table'),'Table'[Month]<=MAX('Table'[Month]))
 RETURN
SUMX(_tb,'Table'[Debit]-'Table'[Credit])+20000

 

vdengllimsft_0-1732155994632.png

 

Please see the attached pbix for reference.

Best Regards,
Dengliang Li

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

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

I have solved a similar question in the attached files.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

I have solved a similar question in the attached files.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-denglli-msft
Community Support
Community Support

Thanks for the reply from rajendraongole1, please allow me to provide another insight.
Hi @LB-Tech ,

Please try the following DAX.

Output = 
 VAR _tb = FILTER(ALL('Table'),'Table'[Month]<=MAX('Table'[Month]))
 RETURN
SUMX(_tb,'Table'[Debit]-'Table'[Credit])+20000

 

vdengllimsft_0-1732155994632.png

 

Please see the attached pbix for reference.

Best Regards,
Dengliang Li

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

rajendraongole1
Super User
Super User

Hi @LB-Tech - can you try the below measure:

Output =
VAR CurrentMonth = MAX('Table'[Month]) -- Current row's month
VAR OpeningBalance = 20000 -- Your initial balance
VAR PreviousBalance =
CALCULATE(
[Output],
FILTER(
ALL('Table'[Month]),
'Table'[Month] < CurrentMonth
)
)
VAR Debit = SUM('Table'[Debit])
VAR Credit = SUM('Table'[Credit])
RETURN
IF(
ISBLANK(Debit) && ISBLANK(Credit),
BLANK(), -- Leave blank when both Debit and Credit are blank
COALESCE(PreviousBalance, OpeningBalance) + Debit - Credit
)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thank you. But this not giving correct value.

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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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