Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
andreaturri27
Helper I
Helper I

Increase Order and Price

Good Morning,

 

sorry for my english. 

 

How calculate increase / Decrease item and  % increse  in this table?

Immagine.png

 

Thank you 

 

2 ACCEPTED SOLUTIONS
v-janeyg-msft
Community Support
Community Support

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] ) - b
Measure2 = 
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] )
    )

vjaneygmsft_0-1635240012825.png

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

View solution in original post

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] ) - b

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

 

View solution in original post

4 REPLIES 4
andreaturri27
Helper I
Helper I

Thaks for reply @v-janeyg-msft  but in my table have a lot value in this table.

i must verify item and ExpectedDeliveryDate...

desk2.png

how do to solve?

Thank you

 

Andrea

 

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] ) - b

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

 

v-janeyg-msft
Community Support
Community Support

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] ) - b
Measure2 = 
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] )
    )

vjaneygmsft_0-1635240012825.png

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

goncalogeraldes
Super User
Super User

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 - _previous

 And 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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.