Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Sum selected by slicer values from 2 not interacted selections

Hello PowerBI Gurus,

 

I want to make a price calculator for materials. I have table with:

Table_1:

Product_ID, Product_Code, Unit_Price
-----

I have one new table with generated series to use as coefficient: 

Variables_Table = GENERATESERIES(0;150;1)
-----

I have also one Measure to multiply the Unit_Price by the measure:

Calculated_Price = MAX(Table_1[Unit_Price])*MAX('Variables_Table '[Value])

----

I want to have 2 slicers for Product_Code and 2 slicers for the Variable, so I can choose 2 products from the product list and to calculate each price, multiplied by the selected Variable value. This 2 groups are not Interacted(I have swithed off the Interactions between them with Format>Edit Interactions), so I can choose values from the same table on one page independently.

To this moment everything works fine, but i want to sum both calculated prices. How I can do this in PowerBI?

Thanks in advance!

BR

 

  • Anonymous 

    The product of sum needs a row context. Try like

    Calculated_Price = calculate(MAX(Table_1[Unit_Price])*MAX('Variables_Table '[Value]),Table_1[product])
    
    Calculated_Price = sumX(summarize(Table_1,,Table_1[product],"_max",MAX(Table_1[Unit_Price])*MAX('Variables_Table '[Value])),[_max])

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hey Anonymous 

     

    What you need if a formula that uses your slicer value. See this thread: https://community.powerbi.com/t5/Desktop/Passing-Slicer-Value-into-Calculated-Formula-to-display-the/td-p/373218

     

    All you have to do is create a measure that uses the guidelines in the thread above to find your slicer value for each slicer and then plug your calculated price into the formula using the slicer value as your FILTER instead of MAX for each slicer and then add the two together.

    • amitchandak's avatar
      amitchandak
      Icon for Super User rankSuper User

      Anonymous 

      The product of sum needs a row context. Try like

      Calculated_Price = calculate(MAX(Table_1[Unit_Price])*MAX('Variables_Table '[Value]),Table_1[product])
      
      Calculated_Price = sumX(summarize(Table_1,,Table_1[product],"_max",MAX(Table_1[Unit_Price])*MAX('Variables_Table '[Value])),[_max])
      • Anonymous's avatar
        Anonymous
        Not applicable

        Can you explain me what are these - measures or calculated column? I tried them bu no success. Maybe I'm doing something wrong 😞

        Calculated_Price = calculate(MAX(Table_1[Unit_Price])*MAX('Variables_Table '[Value]),Table_1[product]) 

        Calculated_Price = sumX(summarize(Table_1,,Table_1[product],"_max",MAX(Table_1[Unit_Price])*MAX('Variables_Table '[Value])),[_max])