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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

COMPARE CURRENT MONTH PRICE VS CUMULATIVE LAST YEAR

Hi

 

I´m looking the way to compare my current month price vs last year cumulative final price, the calculation is something like this:

 

ITEMMONTHMONTH PRICEAVG PRICEDIF 
ITEM 1oct-1755  
ITEM 2oct-172020  
ITEM 3oct-178080  
ITEM 1nov-17107.5  
ITEM 2nov-173326.5  
ITEM 3nov-178582.5  
ITEM 1dic-1777.3  
ITEM 2dic-172526.0  
ITEM 3dic-178081.7  
ITEM 1ene-18111150% current ene-18 price vs YTD average price of 2017)
ITEM 2ene-182222-15% current ene-18 price vs YTD average price of 2017)
ITEM 3ene-18909010% current ene-18 price vs YTD average price of 2017)
ITEM 1feb-1847.52% current feb-18 price vs YTD average price of 2017)
ITEM 2feb-181518.5-29% current feb-18 price vs YTD average price of 2017)
ITEM 3feb-189190.511% 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 18feb-18
 DIF CURRENT MONTH VS AVERAGE PRICE OF ALL 2017DIF CURRENT MONTH VS AVERAGE PRICE OF ALL 2017
ITEM 150%2%
ITEM 2-15%-29%
ITEM 310%11%

 

 

Thank you

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.