cancel
Showing results for
Did you mean:

## Conditional sum ?

Dear.

Greetings first of all.

I have a card that shows me the total of a column.

The problem is that the table is more or less like this:

CustomerID, Amount, Status

1,100,Cancelled

1,100,Derivative

1,100,Active

The customer wants the total to be shown on the card to be 100, since the client is the same, and the values will always be repeated in these cases, ONLY the state changes, and also the state will not always be the same UFFF

1 ACCEPTED SOLUTION
Community Support

Please update the formula of measure [LineaUtilizada] as below and check whether it can get the correct result. You can find the attachment for more details.

``````LineaUtilizada =
SUMX (
SUMMARIZE (
'CLIENTES_PowerBI',
'CLIENTES_PowerBI'[RUT CLIENT],
"Max lineused", MAX ( 'CLIENTES_PowerBI'[LINE USED] )
),
[Max lineused]
)``````

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
7 REPLIES 7
Community Support

You can create a measure as below and check whether it can get your desired result. If no, please provide more sample data with Text format and your expected result with backend logic and special examples. Thank you.

``````Amount for per customer =
CALCULATE (
MAX ( 'Customers'[Amount] ),
ALLEXCEPT ( 'Customers', 'Customers'[CustomerID] )
)``````

Best Regards

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

Hello. it works almost perfect for me, use the formula for 2 measures:

The result should be quota = 150,000 Line Used = 272 , the latter does not work for me.

The measures I use are:

Quota =
CALCULATE (
MAX ( CLIENTES_PowerBI[QUOTA] ),
ALLEXCEPT ( CLIENTES_PowerBI, CLIENTES_PowerBI[RUT CLIENT])
)
CALCULATE (
MAX ( CLIENTES_PowerBI[LINE USED] ),
ALLEXCEPT ( CLIENTES_PowerBI, CLIENTES_PowerBI[RUT CLIENT])
)
I think it's because I have that same date for other months, and I'm wanting to show the last month.
For the case of the line shows me data from March, detail of the table:

Community Support

Please try to update the formula of your measure [Quota] as below and check whether you can get the correct result. If no, please provide some sample data in table CLIENTES_PowerBI (exclude sensitive data) and your expected result with calculation logic and special examples. By the way, what's the meaning of "last month"? It means that the latest date for per customer or something else? Thank you.

I think it's because I have that same date for other months, and I'm wanting to show the last month.

``````LineaUtilizada =
VAR _mindate =
CALCULATE (
MIN ( 'CLIENTES_PowerBI'[FechaProceso] ),
ALLEXCEPT ( 'CLIENTES_PowerBI', 'CLIENTES_PowerBI'[RUT CLIENT] )
)
RETURN
CALCULATE (
MAX ( 'CLIENTES_PowerBI'[LINE USED] ),
FILTER (
ALLEXCEPT ( 'CLIENTES_PowerBI', 'CLIENTES_PowerBI'[RUT CLIENT] ),
'CLIENTES_PowerBI'[FechaProceso] = _mindate
)
)``````

Best Regards

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

Hi, last month's thing don't consider.

The calculation of LineaUtilizada should have the sum of all customers in case of not filtering by a particular id, I explain:

For the image that you indicate to me you should add the following values.

1,272
2,272
3,272

The sum of the maximum value for each ID

SUM= 816

Community Support

Please update the formula of measure [LineaUtilizada] as below and check whether it can get the correct result. You can find the attachment for more details.

``````LineaUtilizada =
SUMX (
SUMMARIZE (
'CLIENTES_PowerBI',
'CLIENTES_PowerBI'[RUT CLIENT],
"Max lineused", MAX ( 'CLIENTES_PowerBI'[LINE USED] )
),
[Max lineused]
)``````

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User

Hi,

What result do you want to see on the card visual when there are multiple CustomerID's.  Show the result clearly.

Regards,
Ashish Mathur
http://www.ashishmathur.com

I want to show 1100

Announcements

#### Power BI T-Shirt Design Challenge 2023

Vote for your favorite t-shirt design now through March 28.

#### Power BI March 2023 Update

Find out more about the March 2023 update.

#### March 2023 Events

Find out more about the online and in person events happening in March!

Top Solution Authors
Top Kudoed Authors