March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi
I´m looking the way to compare my current month price vs last year cumulative final price, the calculation is something like this:
ITEM | MONTH | MONTH PRICE | AVG PRICE | DIF | |
ITEM 1 | oct-17 | 5 | 5 | ||
ITEM 2 | oct-17 | 20 | 20 | ||
ITEM 3 | oct-17 | 80 | 80 | ||
ITEM 1 | nov-17 | 10 | 7.5 | ||
ITEM 2 | nov-17 | 33 | 26.5 | ||
ITEM 3 | nov-17 | 85 | 82.5 | ||
ITEM 1 | dic-17 | 7 | 7.3 | ||
ITEM 2 | dic-17 | 25 | 26.0 | ||
ITEM 3 | dic-17 | 80 | 81.7 | ||
ITEM 1 | ene-18 | 11 | 11 | 50% | current ene-18 price vs YTD average price of 2017) |
ITEM 2 | ene-18 | 22 | 22 | -15% | current ene-18 price vs YTD average price of 2017) |
ITEM 3 | ene-18 | 90 | 90 | 10% | current ene-18 price vs YTD average price of 2017) |
ITEM 1 | feb-18 | 4 | 7.5 | 2% | current feb-18 price vs YTD average price of 2017) |
ITEM 2 | feb-18 | 15 | 18.5 | -29% | current feb-18 price vs YTD average price of 2017) |
ITEM 3 | feb-18 | 91 | 90.5 | 11% | current feb-18 price vs YTD average price of 2017) |
At the end I want to show a matrix with the item lista and their difference
JAN 18 | feb-18 | |
DIF CURRENT MONTH VS AVERAGE PRICE OF ALL 2017 | DIF CURRENT MONTH VS AVERAGE PRICE OF ALL 2017 | |
ITEM 1 | 50% | 2% |
ITEM 2 | -15% | -29% |
ITEM 3 | 10% | 11% |
Thank you
Solved! Go to Solution.
HI @Anonymous ,
You can try to use following measure formula to compare current amount with previous YTD average:
Diff = VAR currDate = MAX ( Table[Month] ) VAR currPrice = CALCULATE ( SUM ( Table[Month Price] ), ALLSELECTED ( Table ), VALUES ( Table[Item] ), VALUES ( Table[Month] ) ) VAR PrevYTD = CALCULATE ( AVERAGE ( Table[Month Price] ), FILTER ( ALLSELECTED ( Table ), YEAR ( Table[Month] ) = YEAR ( currDate ) - 1 && Table[Month] <= DATE ( YEAR ( currDate ) - 1, MONTH ( currDate ), DAY ( currDate ) ) ), VALUES ( Table[Item] ) ) RETURN currPrice - prevYTD
Notice: I still not so sure for detail compare calculation, you can modify bold part with your own calculation formulas.
Regards,
Xiaoxin Sheng
HI @Anonymous ,
You can try to use following measure formula to compare current amount with previous YTD average:
Diff = VAR currDate = MAX ( Table[Month] ) VAR currPrice = CALCULATE ( SUM ( Table[Month Price] ), ALLSELECTED ( Table ), VALUES ( Table[Item] ), VALUES ( Table[Month] ) ) VAR PrevYTD = CALCULATE ( AVERAGE ( Table[Month Price] ), FILTER ( ALLSELECTED ( Table ), YEAR ( Table[Month] ) = YEAR ( currDate ) - 1 && Table[Month] <= DATE ( YEAR ( currDate ) - 1, MONTH ( currDate ), DAY ( currDate ) ) ), VALUES ( Table[Item] ) ) RETURN currPrice - prevYTD
Notice: I still not so sure for detail compare calculation, you can modify bold part with your own calculation formulas.
Regards,
Xiaoxin Sheng
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
133 | |
90 | |
88 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
70 | |
68 |