Forum Discussion

6 Replies

  • Anonymous's avatar
    Anonymous
    Not 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's avatar
      orghn
      Icon for Helper I rankHelper 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's avatar
        Whitewater100
        Icon for Solution Sage rankSolution 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())