cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Resolver I

## Conditional Calculation Based on Category

Hi all,

I have quite complicated logic that I need to apply.

In his scenario, I have table Brand with their revenue amount.

I need to re-allocate "Default" to brand where revenue > 0, except for D. Brand D is automatically excluded from reallocation no matter if its revenue >0.

For example:

 Brand Amount A 3000 B -2000 C 8000 D 2000 Default -1000

In this case, I need to allocate Default(-1000) to Brand A and C only. How do I do the condition based on logic stated? Please help:(

1 ACCEPTED SOLUTION
Community Support

Hi, @kilala

You can try the following methods.

``````Measure =
IF (
SELECTEDVALUE ( 'Table'[Brand] ) = "D",
SELECTEDVALUE ( 'Table'[Amount] ),
IF (
SELECTEDVALUE ( 'Table'[Amount] ) > 0,
-1000,
SELECTEDVALUE ( 'Table'[Amount] )
)
)
``````

Best Regards,

Community Support Team _Charlotte

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

4 REPLIES 4
Community Support

Hi, @kilala

You can try the following methods.

``````Measure =
IF (
SELECTEDVALUE ( 'Table'[Brand] ) = "D",
SELECTEDVALUE ( 'Table'[Amount] ),
IF (
SELECTEDVALUE ( 'Table'[Amount] ) > 0,
-1000,
SELECTEDVALUE ( 'Table'[Amount] )
)
)
``````

Best Regards,

Community Support Team _Charlotte

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

Anonymous
Not applicable

Resolver I

Hi @Anonymous ,

thank you for your suggestion, but currently i'm not able to add new column as i connect to live dataset. I can only create measures here. i think to use filter but it cannot return multiple columns.

Anonymous
Not applicable

ok, Try it

``````Measure =
IF (
SELECTEDVALUE ( 'Table (3)'[Brand] ) = "D",
SELECTEDVALUE ( 'Table (3)'[Brand] ),
IF (
SELECTEDVALUE ( 'Table (3)'[Amount] ) > 0,
"Default",
SELECTEDVALUE ( 'Table (3)'[Brand] )
)
)``````

Announcements

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors