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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
stefani_vileva
Resolver II
Resolver II

Calculating measure using parameter and filter

Hello everyone,

 

I have a table where I have a price for each product. The goal is to calculate new price for selected values using a value chosen from parametar. For example, I have the following table:

ProductPrice
A0.4
B0.1
C

0.3

 

Using the filter, I am for example choosing only A and C as products (the filter should not filter the whole table, but just to select the following products), and using parametar filter I am increasing the price from 0.4 to 0.5 and 0.3 to 0.4 respectively to products A and C with the following new table,

ProductOld priceNew price
A0.40.5
B0.10.1
C0.30.4

 

I have tried using a separate table that is not connected by product name, and I wanted to compare the names of the two different tables (products, orders - in products I have the product names and in orders I have the all orders for the products and their prices).

I have using the following DAX to see if the selected product name is the same as the one in orders name so that I could recalculate the new price. 

 

 

 

 

IF(CALCULATE(SELECTEDVALUE(Orders[Product])=SELECTEDVALUE(Products[Name])),
SELECTEDVALUE('Increase Price'[Increase Price]) * Prodcts[Price (piece)] + Products[Price (piece)], Products[Price (piece)])

 

 

 

 

If you have any questions, please let me know.

 

Thanks in advance.

Kind regards,

Stefani

1 ACCEPTED SOLUTION

Hello @lbendlin ,

 

Thank you for your answer, actually I solved the problem like this:

IF(SELECTEDVALUE(Orders[Product]) IN VALUES(Products[Name]), [Price (piece)]*Percentage[Percentage value] + [Price (piece)], [Price (piece)])

but now actually I have the problem with the summarization.  The summary takes all of the values as one not row by row..

Do you know maybe the solution to that problem?

 

Thank you very much.

Kind regards,

Stefani

 

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

Using a disconnected table is the right first step.  The next step is to figure out which products the user has selected. For that you can use FILTERS, and then you can check if the product in the current context intersects with the result. If yes, apply the uplift, if no, keep the original price.

Hello @lbendlin ,

 

Thank you for your answer, actually I solved the problem like this:

IF(SELECTEDVALUE(Orders[Product]) IN VALUES(Products[Name]), [Price (piece)]*Percentage[Percentage value] + [Price (piece)], [Price (piece)])

but now actually I have the problem with the summarization.  The summary takes all of the values as one not row by row..

Do you know maybe the solution to that problem?

 

Thank you very much.

Kind regards,

Stefani

 

I should have used SUMX instead of SUM, when summing up measures.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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