cancel
Showing results for
Did you mean:

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

Frequent Visitor

## Add Column: conditional statement and numeric parameter

I created a numeric parameter that allows the user to choose a value between 0 and 20.

And a measure that tells me what number was chosen:

I have a table Product and I want to add a column that gives me the new price.

The column New Price should mantain the price for products B and C, and attribute a new price for product A that correspondes to the current price in table Product multiplied by the 'ChosenNumber'.
This is the result:

As you can see, for product A the new price is blank.

6 REPLIES 6
Solution Supplier

Hey @D_P Can you please share expected output?

Frequent Visitor

Assuming that this was the user input:

The expected output was:

Solution Supplier

Hey @D_P
Instead of creating a calculated column, create a measure using the below code

`New Price = IF(    SELECTEDVALUE(TableA[Name]) = "A",     CALCULATE(Parameter[Parameter Value] * SELECTEDVALUE(TableA[Price])),    MAX(TableA[Price]))`

You will get the following output

If this helps you then please give it a kudo and mark my solution as accepted so that other can find it quickly on facing similar issue. Thank You!

Frequent Visitor

Hi PowerBI wizard @Dhairya!
Thank you for the solution provided.
But on this specific case I really need it to be a calculated column.
Any other cards on your sleeve?

Solution Sage

I don't think you can use a Measure in this type of Column calculation. If you swap out [ChosenNumber] for a literal value, it will show proper results, right?

Frequent Visitor

Yes, you're right. But I need it to be dinamic, meaning, I need to be able to change it here

And see it reflected on the Product table.

Do you have any other suggestions on how this can be achieved?

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.

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