Forum Discussion
Inventory price update
- Anonymous5 years ago
Hi Raulx_7
According to your statement, I know your have three tables.
- Dates
- Products
- Price
From your code, I think Price table should be related with Dates table, but I don't know what your data model actually looks like.
I think your connection mode is live connection, so you couldn't build a rank column.
I update the measure.
NewMeasure = VAR _CPrice = SUM ( 'Price'[Price] ) VAR _LastMonthEnd = EOMONTH ( MAX ( 'Date'[Date] ), -1 ) VAR _LastMonthStart = EOMONTH ( MAX ( 'Date'[Date] ), -2 ) + 1 VAR _LMPrice = CALCULATE ( SUM ( 'Price'[Price] ), FILTER ( ALL ( 'Date' ), 'Date'[Date] >= _LastMonthStart && 'Date'[Date] <= _LastMonthEnd ) ) RETURN _CPrice - _LMPriceResult is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks, but my problem is that I cannot edit the tables and relations in this dashboard (is connected to a cube), I can only create measures. Then create the rank column is not possible.
Hi Raulx_7
According to your statement, I know your have three tables.
- Dates
- Products
- Price
From your code, I think Price table should be related with Dates table, but I don't know what your data model actually looks like.
I think your connection mode is live connection, so you couldn't build a rank column.
I update the measure.
NewMeasure =
VAR _CPrice =
SUM ( 'Price'[Price] )
VAR _LastMonthEnd =
EOMONTH ( MAX ( 'Date'[Date] ), -1 )
VAR _LastMonthStart =
EOMONTH ( MAX ( 'Date'[Date] ), -2 ) + 1
VAR _LMPrice =
CALCULATE (
SUM ( 'Price'[Price] ),
FILTER (
ALL ( 'Date' ),
'Date'[Date] >= _LastMonthStart
&& 'Date'[Date] <= _LastMonthEnd
)
)
RETURN
_CPrice - _LMPrice
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.