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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.