Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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 increase per category given that there are items that were stopped selling this month and vice versa.
Here is an example of tables with dummy data:
Table of dimensions of articles:
Table of facts:
Output shown by Power BI:
The problem is for example in the category "armchairs" article 7 stopped selling but wanting to get the average increase of that category Power Bi does (16 + 10 + 20) / (6 + 10 + 8 + 16) when in reality it should do (16 + 10 + 20) / (10 + 8 + 16).
Power Bi's measure for getting the current price and the previous price are as follows:
Solved! Go to Solution.
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)/ant
Best Regards,
Jay
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)/ant
Best Regards,
Jay
@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:
@Syndicate_Admin , Try like, assuming your [Current price] and [Previous price] are working fine
Meausre =
Var _1 = [Current price]
var _2 = [Previous price]
return
divide(sumx(filter(values(Table[Category]), not(isblank(_2))),_1),_2)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
105 | |
87 | |
74 | |
66 |
User | Count |
---|---|
124 | |
112 | |
96 | |
80 | |
72 |