Forum Discussion

CMOLINA's avatar
CMOLINA
Frequent Visitor
3 years ago
Solved

How to create a Price Index (see image)

Hello Team, I have a problem to calculate the Index Price or calculate (divide) al Column_Value/ Select_Product_Value (same column in this case Price). What is your suggest to Select the produc with...
  • PaulDBrown's avatar
    3 years ago

    Here is one way. Set up the model with a dimension table (recommended) and an independent table for product (you will be using this independent product table for the slicer). The model looks like this:

     Set up the table visual using the field from the Product table; the slicer from the 'Select Product' table.

    Then these measures:

    Price = 
    DIVIDE(SUM(fTable[Venta]), SUM(fTable[Unidades]))

    and

    Index =
    VAR _Selected =
        CALCULATE (
            [Price],
            FILTER (
                ALL ( 'Product Table' ),
                'Product Table'[dProducto] = SELECTEDVALUE ( 'Select Product'[Producto Sel] )
            )
        )
    RETURN
        DIVIDE ( [Price], _Selected )
    

    and you will get

     

    sample pbix file attached

  • CMOLINA's avatar
    3 years ago

    WOW Excellent!!!

    Rock Star!