Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Regular Visitor

Competitiveness index

Hi all, 


I'm having some trouble with the Dax logic. I have a data set, which I don't have access right now, but the structure is simple:


Data - product ID - product description - brand - paid price


Each observation is a sold product. It is not grouped by quantity. 

My objective is to group these events by date and brand, calculate the average price by brand, and also an competiveness index, which I'm struggling to create.


The index reasoning is not a big deal, I want to use a specific brand as a reference and calculate the relativity between the other brands. 

For example, I have three brands, (Nike, adidas, puma). Referencing "Nike" as an example, I would like to divide the avg price from Adidas and puma separately, and as a final result understand the relativity between the brands.


Using Dax, I tried doing the following:

"compt:= IF(table[brand] ="Nike", 1, table[price] / Calculate(Average(table[price]), Filter(table, table[brand] = "Nike" "


My objective here was to normalize my reference and then divide each observation, so I could obtain the result for each brand. 

The result is not what I expect, usually the result is always "infinite"


Unfortunately I really don't have the data available at this moment, but later I would be able to update the section if needed.

I would appreciate all the help, and tips, since I'm a new user, it is always a challenge. 



Regular Visitor

@amitchandak, thanks for the reply, unfortunately it didn't work.


I could achieve some success by creating a calculated column and applying the formula below:


compt_index = DIVIDE(InfoPrice[PrecoPadrao], 
                    AVERAGEX(InfoPrice, InfoPrice[avg_price_brand]),
                        FILTER(InfoPrice, InfoPrice[Marca] = "Brand1"), 
                        FILTER(InfoPrice, InfoPrice[Data].[Ano] = EARLIER(InfoPrice[Data].[Ano])),
                        FILTER(InfoPrice, InfoPrice[Data].[Mês] = EARLIER(InfoPrice[Data].[Mês]))


*[avg_price_brand] is another calculated column that is just the avg price of the whole table.


It works in a scenario that i don't have filters other than data, which i could achieve by using the earlier function.

Year2022 Year2023
 Avg. PriceAvg. Of Competiveness IndexAvg. PriceAvg. Of Competiveness Index


However, i have other segmentation filters that the user will be able to choose, for example, "State", "Packing size", "Brand" and/or "Volume".

These addtional filters didn't work in a calculated column by including the same FILTER() formula and assigning the SELECTEDVALUE(InfoPrice[State]) but no success at all.

I also tried to include this formula in a measure, but the earlier function does not fit in it, formula below:


compt_ind_2 = 
    var preco_ref = 
            CALCULATE(AVERAGEX(InfoPrice, InfoPrice[price]), 
                FILTER(InfoPrice, InfoPrice[Marca] = "brand4")

    var avg_marcas = 
        VAR flt_uf = SELECTEDVALUE(Aux_UF[DescUF])
        VAR flt_emb = SELECTEDVALUE(Aux_Produtos[Pack_size])
        VAR flt_vol = SELECTEDVALUE(Aux_Produtos[Volume])
        VAR flt_channel = SELECTEDVALUE(Aux_TipoDeLoja[TipoPadrao])
        CALCULATE(AVERAGEX(InfoPrice, InfoPrice[brand]),
            FILTER(InfoPrice, InfoPrice[brand]), InfoPrice[brand],
                Aux_UF[DescUF] = flt_uf,
                Aux_Produtos[pack_size] = flt_emb,
                Aux_Produtos[Volume] = flt_vol,
                Aux_TipoDeLoja[TipoPadrao] = flt_channel
    var compt_ind = 
        DIVIDE(avg_marcas, preco_ref)
return compt_ind



Any ideas on how to proceed?



Super User
Super User

@jgap98 , Based on what I got  measure like


Calculate( calculate(Averagex(Values(Table[Brand]) , calculate(Average(Table[Price]) ) )

, allselected())





calculate(Averagex(Values(Table[Brand]) , calculate(Average(Table[Price]), filter(Table[Brand] <>Max(Table[Brand] ) )

, allselected())

Helpful resources

PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors