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
orghn
Helper I
Helper I

Help on measure

Hi Everyone!


I need to select only 1 lab and N products. I need to find the price per month of my product (my_price) and compare to the total_prod_price to find the difference (%) between my product and the others.

 

Sample file: https://www.dropbox.com/s/jh9ctxatt079dvq/Sample%28Updated2%29%20%281%29.pbix?dl=0

orghn_0-1644511365452.png

 

 

6 REPLIES 6
v-yangliu-msft
Community Support
Community Support

Hi  @orghn ,

Here are the steps you can follow:

1. Create measure.

My_Price =
var _select=SELECTCOLUMNS('Product',"1",'Product'[ProductName])
var _selectmonth=SELECTEDVALUE('Price'[Month])
return
CALCULATE(SUM('Price'[Price]),FILTER(ALL('Price'),'Price'[Month]=_selectmonth&&'Price'[Product] in _select))
Total_Prod_Price =
SUMX(FILTER(ALL('Price'),'Price'[Product]=MAX('Price'[Product])),'Price'[Price])

2. Result:

According to the slicer, if you select [Lab_Name]=”Lab B”, [Product Name] will show the addition of the data of Prodct E and Product B according to the Product table

vyangliumsft_0-1644804438553.png

 

vyangliumsft_1-1644804438558.png

If you want to select ABC to appear, you can just select ProdctName=”A”,”B”,”C”.

vyangliumsft_2-1644804438562.png

 

Best Regards,

Liu Yang

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

Hi @v-yangliu-msft , thanks for your reply, maybe I explained wrong. I need this output:

orghn_0-1644843735094.png

My price should be the price for that month of the products from the selected Lab. 1500 should be for the first 3 rows and 1600 fir the last 3.

Hi:

This gives you the price avg but in the grid it get's weird. Standing alone it is fine for getting your avg monthly product prices. 

Price Avg = AVERAGEX(SUMMARIZE('Price',
'Price'[Price],'Price'[Product], 'Price'[Month]),
'Price'[Price])
 
This one works in your grid but your  price table has aditional rows with very low  entries, which impact your avp price measures.
 
Price Avg Final = CALCULATE([Price Avg], REMOVEFILTERS())
 
Whitewater100_0-1644878364240.png

 

Yes, because I have many products for my lab, I only need the Lab and products selected

Hi:

Did you use the solution file? Thanks..

Yes, I´m working with the attached file but I need to see all the products but only my price on the first column

 

orghn_0-1645015349971.png

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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