Forum Discussion
Syndicate_Admin
Administrator
5 years agoAverage price increase
Good afternoon, I was asked to analyze the price variations of different items individually and grouped by their category (Furniture, shelves, armchairs). I have the problem to calculate the average ...
- Anonymous4 years ago
Hi Syndicate_Admin ,
Check the formula.
Measure 3 = var act = CALCULATE(SUM('fact'[precio actual]),FILTER(ALL('fact'),'fact'[articulo] in VALUES('dimensions'[articulo]))) var ant = CALCULATE(SUM('fact'[precio anterior]),FILTER(ALL('fact'),'fact'[articulo] in VALUES('dimensions'[articulo]) && 'fact'[precio actual] <> BLANK())) return (act-ant)/antBest Regards,
Jay
Syndicate_Admin
Administrator
5 years ago@Syndicate_Admin thank you very much for the help!!! Trying to replicate the suggested measurement the result showing the Power Bi is not correct. I don't know exactly what he is doing but as an example, a category that should give an increase of 7.32% shows me 12.88%. The measure was like this:
Measure 1 =
var priceCurrent = [Current price]
var pricePrevious = [Previous price]
return
DIVIDE(sumx(FILTER(values(DIM_Articulos); NOT(ISBLANK(precioAnterior)));precioActual);precioAnterior)
Modifying some things to the extent I came to the same result by which the original query was generated. That is to say, it continues to consider for the calculation of the average by category items whose sale was discontinued.
The adapatada measure with which I arrived at the same erroneous "original" resutado is:
Measure 2 =
var current price = [current price]
var pricePrevious = [Previous price]
return
DIVIDE(sumx(FILTER(values(DIM_Articulos[Clasificador 7 articulos]); NOT(ISBLANK(precioAnterior)));precioActual);precioAnterior)-1
Thank you very much for the help!!!!
Best regards