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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Syndicate_Admin
Administrator
Administrator

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

Please any help that will be added.

1 ACCEPTED SOLUTION

Hi @CristianCL21,

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]
)

yingyinr_0-1628646159640.png

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.

View solution in original post

7 REPLIES 7
v-yiruan-msft
Community Support
Community Support

Hi @CristianCL21,

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] )
)

yingyinr_0-1628493208404.png

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.

CristianCL21_0-1628548100211.png

The measures I use are:

Quota =
CALCULATE (
MAX ( CLIENTES_PowerBI[QUOTA] ),
ALLEXCEPT ( CLIENTES_PowerBI, CLIENTES_PowerBI[RUT CLIENT])
)
LineaUtilizada =
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:
CristianCL21_0-1628549168868.png

Hi @CristianCL21,

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

yingyinr_0-1628561227259.png

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

Hi @CristianCL21,

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]
)

yingyinr_0-1628646159640.png

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.
Ashish_Mathur
Super User
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
https://www.linkedin.com/in/excelenthusiasts/

I want to show 1100

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.