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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Yrstruly2021
Helper V
Helper V

Formula To Excel

Pease give DAX for =-SUMIF(Details!B:B;'Cash Flow'!G34;Details!G:G)+4801. I have 

DebtorMovements =
CALCULATE(
    -SUM('ZTBR'[Amount in USD]),
    'ZTBR'[Roll_Up_Function] IN {"Debtor Movements"}
) + 4801
 
Is this correct?
It gives me the value, but that same value then displays for all the rows, which should not be.
7 REPLIES 7
Anonymous
Not applicable

Hi @Yrstruly2021 ,

 

You can try formula like below:

DebtorMovements = 
CALCULATE(
    -SUMX(
        FILTER(
            'ZTBR',
            'ZTBR'[Roll_Up_Function] = "Debtor Movements"
        ),
        'ZTBR'[Amount in USD]
    ),
    'ZTBR'[Roll_Up_Function] = "Debtor Movements"
) + 4801

vkongfanfmsft_1-1707289722916.png

 

Best Regards,
Adamk Kong

 

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

 

 

govindarajan_d
Super User
Super User

Hi , 

Can you try like this? 

DebtorMovements =
CALCULATE (
    - SUM ( 'ZTBR'[Amount in USD] ),
    KEEPFILTERS ( 'ZTBR'[Roll_Up_Function] IN { "Debtor Movements" } )
) + 4801

In your formula, it overwrites the existing filters (inc. filter context) and calculates the value. When you use KEEPFILTERS it respects the filter context. 

 

For more info: https://www.sqlbi.com/articles/using-keepfilters-in-dax/

 

 

 

 

@Yrstruly2021

It is not suppose to list values for every row.

Yrstruly2021_0-1707223217382.png

 

Try this:

 

DebtorMovements=
IF (
    SELECTEDVALUE('ZTBR'[Roll_Up_Function])="Debtor Movements",
    CALCULATE (-SUM ('ZTBR'[Amount in USD]),'ZTBR'[Roll_Up_Function]="Debtor Movements")+4801,
    BLANK()
)

This code eliminate the assigned values to rows that shoul not have these values, but it does not give me the total like the other codes does.

Yrstruly2021_0-1707313527509.png

 

Hi @Yrstruly2021 ,

 

Please try this:

DebtorMovements=
IF(
	HASONEVALUE('ZTBR'[Roll_Up_Function]),
	IF (
		SELECTEDVALUE('ZTBR'[Roll_Up_Function])="Debtor Movements",
		CALCULATE (-SUM ('ZTBR'[Amount in USD]),'ZTBR'[Roll_Up_Function]="Debtor Movements")+4801,
		BLANK()
	),
	CALCULATE (-SUM ('ZTBR'[Amount in USD]),'ZTBR'[Roll_Up_Function]="Debtor Movements")+4801
)

 

Upvote and accept as solution if this helped!

Hi @Yrstruly2021 ,

 

Did the provided solution work?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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