cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

## 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

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors