DAX Formula calculate + Filter error

Petersx

New Member
Joined
Nov 2, 2015
Messages
11
Good Morning,

i have a problem with a formula in DAX.
I would work with a measure to sum only the negative values.

My last idea:
Test = CALCULATE(SUM(AswKpf[Restmenge]);FILTER(AswKpf[Restmenge];AswKpf[Restmenge]) > 0))

Can anybody help me?
I find only examples with date in the internet....

best regards,
Peter
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
If you want to sum up all the negative values in column Restmenge from the table AswKpf, try using CALCULATE's own filters:
=CALCULATE(SUM(AswKpf[Restmenge]),AswKpf[Restmenge]<0)
If you prefer positive values instead, change the sign:
=CALCULATE(SUM(AswKpf[Restmenge]),AswKpf[Restmenge]>0)
 
Upvote 0
If you want to sum up all the negative values in column Restmenge from the table AswKpf, try using CALCULATE's own filters:
=CALCULATE(SUM(AswKpf[Restmenge]),AswKpf[Restmenge]<0)
If you prefer positive values instead, change the sign:
=CALCULATE(SUM(AswKpf[Restmenge]),AswKpf[Restmenge]>0)


thanks sinon, thats perfect.
But now, my next problem:

turnover = CALCULATE(SUM([Measure*]);[Measure]<0)

i get a error: formula can not work with true/false-expression


*Measure = Formula to calculate Value * pieces
 
Upvote 0
So you created another calculated field called "Measure"? How exactly is this calculated? Maybe a sample of your data and created measures would help. You can share those by uploading it to a cloud (like dropbox) and sharing the link.
 
Upvote 0
Upvote 0
So you created another calculated field called "Measure"? How exactly is this calculated? Maybe a sample of your data and created measures would help. You can share those by uploading it to a cloud (like dropbox) and sharing the link.

Measure is calculated with sum and min
Measure = MIN(turnover[ storage]) - SUM(turnover[orders])
 
Upvote 0
turnover = CALCULATE(SUM([Measure*]);[Measure]<0)

The 2nd param to calculate must be a "simple expression" or a table. You can't use a measure there without wrapping it in a FILTER().

turnover = CALCULATE(SUM([Measure*]); FILTER(MyTable, [Measure]<0))
 
Upvote 0
The 2nd param to calculate must be a "simple expression" or a table. You can't use a measure there without wrapping it in a FILTER().

turnover = CALCULATE(SUM([Measure*]); FILTER(MyTable, [Measure]<0))


okey thank you.

Do you have a other idea for my problem? I can not use a table or "simple expression".
Maybe this example helps:

Product | order | Warehouse
A..................40.................50
B..................50.................60
A..................50.................50
A..................10.................50
-------------------------------------------------
First Step:

Product | orders | to produce
A..................100................50
B..................50..................-10

to produce: min(warehouse) - sum(product)
--------------------------------------------------
Second Step (my problem)
summerize only negative values
Goal:
reserve on stock: -10
 
Upvote 0
Sorry, having a hard time understanding your problem.

I can see you have (40+50+10) orders for Product A, WareHouse 50.
And you have (50) orders for Product B, Warehouse 60.

I have no idea where the -10 came from.
 
Upvote 0
Sorry, having a hard time understanding your problem.

I can see you have (40+50+10) orders for Product A, WareHouse 50.
And you have (50) orders for Product B, Warehouse 60.

I have no idea where the -10 came from.


this -10 comes from:

Product B = 50 Orders and a storage with 60 pieces.
so: 50 - 60 = -10

now i would summerize only negative values
hopefully it helps
 
Upvote 0

Forum statistics

Threads
1,225,562
Messages
6,185,675
Members
453,314
Latest member
amitojsd

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top