Forum Discussion
Increase Order and Price
- 4 years ago
Hi, andreaturri27
According to your description, you can create two measures.
Like this:
Measure1 = VAR a = MAXX ( FILTER ( ALL ( 'Table' ), [ExpectedDeliveryDate] < SELECTEDVALUE ( 'Table'[ExpectedDeliveryDate] ) ), [ExpectedDeliveryDate] ) VAR b = MAXX ( FILTER ( ALL ( 'Table' ), [ExpectedDeliveryDate] = a ), [Prezzo acquisto] ) RETURN MAX( 'Table'[Prezzo acquisto] ) - bMeasure2 = VAR a = MAXX ( FILTER ( ALL ( 'Table' ), [ExpectedDeliveryDate] < SELECTEDVALUE ( 'Table'[ExpectedDeliveryDate] ) ), [ExpectedDeliveryDate] ) VAR b = MAXX ( FILTER ( ALL ( 'Table' ), [ExpectedDeliveryDate] = a ), [Prezzo acquisto] ) RETURN DIVIDE ( MAX ( 'Table'[Prezzo acquisto] ) - b, MAX ( 'Table'[Prezzo acquisto] ) )Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.
Best Regards,Community Support Team _ Janey
- 4 years ago
Hi, andreaturri27
You need to modify the code according to your needs.
Like :
Measure1 = VAR a = MAXX ( FILTER ( ALL ( 'Table' ), [ExpectedDeliveryDate] < SELECTEDVALUE ( 'Table'[ExpectedDeliveryDate] )&& [item] < SELECTEDVALUE ( 'Table'[item] ) ), [ExpectedDeliveryDate] ) VAR b = MAXX ( FILTER ( ALL ( 'Table' ), [ExpectedDeliveryDate] = a && [item] < SELECTEDVALUE ( 'Table'[item] )), [Prezzo acquisto] ) RETURN MAX( 'Table'[Prezzo acquisto] ) - bDid I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.
Best Regards,Community Support Team _ Janey
Hello there andreaturri27 ! You can try the following for the variation:
Variation =
VAR _current =
SUM ( Table[Prezzo acquisto] )
VAR _previous =
CALCULATE (
_current,
FILTER (
ALL ( Table[Numero Ordine] ),
Table[Numero Ordine]
= ( SELECTEDVALUE ( Table[Numero Ordine] ) - 1 )
)
)
RETURN
_current - _previousAnd for the percentage change:
% Variation =
VAR _current =
SUM ( Table[Prezzo acquisto] )
VAR _previous =
CALCULATE (
_current,
FILTER (
ALL ( Table[Numero Ordine] ),
Table[Numero Ordine]
= ( SELECTEDVALUE ( Table[Numero Ordine] ) - 1 )
)
)
RETURN
DIVIDE ( _current - _previous, _previous, 0 )And format it as a % field.
Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!
You can also check out my LinkedIn!
Best regards,
Gonçalo Geraldes