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
CMOLINA
Frequent Visitor

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 Slicer (Producto_Base)  and calculate the Index Column (rest of the price products)

Example Index Price.png

 

2 ACCEPTED SOLUTIONS
PaulDBrown
Community Champion
Community Champion

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:

model.jpg

 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

res.gif

 

sample pbix file attached





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

CMOLINA
Frequent Visitor

WOW Excellent!!!

Rock Star!

View solution in original post

2 REPLIES 2
CMOLINA
Frequent Visitor

WOW Excellent!!!

Rock Star!

PaulDBrown
Community Champion
Community Champion

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:

model.jpg

 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

res.gif

 

sample pbix file attached





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






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.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.