Forum Discussion
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
6 Replies
- AnonymousNot applicable
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
If you want to select ABC to appear, you can just select ProdctName=”A”,”B”,”C”.
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
- orghn
Helper I
Hi Anonymous , thanks for your reply, maybe I explained wrong. I need this output:
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.
- Whitewater100
Solution Sage
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())