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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
FabAug
Regular Visitor

Calculate a new column with conditions

Hello Everybody

 

 

I want to calculate a column with a condition. I want to make a SUM of several columns with one condition like this:

 

IF [Estado] = "Pagado"  THEN SUM ([Pago]+[Pago2]+[Pago3]+[Pago4]+[Pago5])

 

IF [Estado] = "En Proceso" THEN DON'T SUM.

 

I'm new on this thanks for your comments.

 

2 ACCEPTED SOLUTIONS
askelton
Resolver I
Resolver I

I believe you could do something like.

 

if([Estado ="Pagado", [Pago] + [Pago2] + [Pago3] + [Pago4] + [Pago5])

View solution in original post

v-shex-msft
Community Support
Community Support

Hi @FabAug,

 

I think switch function will suitable for your requirement.

Sample:

Result =
SWITCH (
    [Estado],
    "En Proceso", "",
    "Pago", [Pago],
    "Pago2", [Pago2],
    "Pagado", [Pago] + [Pago2]
        + [Pago3]
        + [Pago4]
        + [Pago5]
)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @FabAug,

 

I think switch function will suitable for your requirement.

Sample:

Result =
SWITCH (
    [Estado],
    "En Proceso", "",
    "Pago", [Pago],
    "Pago2", [Pago2],
    "Pagado", [Pago] + [Pago2]
        + [Pago3]
        + [Pago4]
        + [Pago5]
)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
askelton
Resolver I
Resolver I

I believe you could do something like.

 

if([Estado ="Pagado", [Pago] + [Pago2] + [Pago3] + [Pago4] + [Pago5])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.