Skip to main content
cancel
Showing results for 
Search instead 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

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
Fabric Community Conference

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.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

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