+ Reply to Thread
Results 1 to 8 of 8

DAX YoY Price change issue if no new price available

  1. #1
    Forum Contributor
    Join Date
    10-14-2020
    Location
    Shanghai
    MS-Off Ver
    O365
    Posts
    157

    DAX YoY Price change issue if no new price available

    Hello

    I need to compare the changes for a price over the last year.
    I created a measure for each year to calculate the price (Y2022Price, Y2021Price) and then the YoY Measure to compare the change

    This works for each single part number but gives me an error in the total if some parts are new (no price in 2021) or some parts are stopped(no price in 2022).

    The measure Y2022Price is only used for the purpose to get the YoY change. So its fine to show only values where in 2022 and 2021 a price is available

    I tried to modify the measure a bit
    Please Login or Register  to view this content.
    but this doesnt work.

    Target is to see the changes YoY for each Partnumber and in total for all

    Any ideas?
    thanks a lot
    Attached Files Attached Files
    Last edited by hansolu; 03-21-2022 at 02:30 AM.

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: DAX YoY Price change issue if no new price available

    The proper way to do this is to create date column and a real calendar table to use Time intelligence functions; eg SAMEPERIODLASTYEAR or DATESINPERIOD

    But this model I'll use

    2021P

    =VAR T = SUMMARIZE(tblPrice,tblPrice[Number],"P",if([Y2022Price],[Y2021Price]))
    return SUMX(T,[P])


    2022P
    =VAR T = SUMMARIZE(tblPrice,tblPrice[Number],"P",if([Y2021Price],[Y2022Price]))
    return SUMX(T,[P])

    Yoy
    =if([2021P],DIVIDE([2022P],[2021P])-1)
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    10-14-2020
    Location
    Shanghai
    MS-Off Ver
    O365
    Posts
    157

    Re: DAX YoY Price change issue if no new price available

    Hi

    thanks a lot for the help
    I was thinking about the proper date previously. I do have another case where the price changes during the year and i need to calculate the total sales considering this situation.

    Guess using the eg SAMEPERIODLASTYEAR or DATESINPERIOD is better.

    I just modified the DM and created out of the year a calender for it.

    How would you do the YoY for this DM?

    thanks a lot
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    10-14-2020
    Location
    Shanghai
    MS-Off Ver
    O365
    Posts
    157

    Re: DAX YoY Price change issue if no new price available

    HI


    I was thinking and studied a bit. Now I added a datetable and also did the pricing for sales and BOM for different periods.
    Everything is working fine. Time Intelligence is really easier to use , thanks for the hint.
    HOwever, 2 issues

    Yellow Cells:
    For my measure YoY SalesPrice % I do not see the totals, same for the measure DeltaSalesYoY(1yr).

    Green Cells:
    Another issue is I want to compare one year (e.g. 2022) and calculate based on January 2020 sales price the impact until now.
    So i have a measure DeltaSalesYoY(2yr). Issue is I dont know why the summary for the years are wrong and how to make the year selection dynamic (based on the hightest year in the chart)

    Any ideas how I can fix this?
    Attached Files Attached Files

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: DAX YoY Price change issue if no new price available

    Issues Measures are calculated based on

    SpotPriceSales

    Please Login or Register  to view this content.

    Since SpotPriceSales give blank for subtotal rows, other Measures refer to SpotPriceSales also give blank


    You need to use if(HASONEVALUE()) to get correct SpotPriceSales on subtotal row before going to the next calculation.

    I don't know how you want to calculate SpotPriceSales yearly.

  6. #6
    Forum Contributor
    Join Date
    10-14-2020
    Location
    Shanghai
    MS-Off Ver
    O365
    Posts
    157

    Re: DAX YoY Price change issue if no new price available

    Hi
    ahh, I see.
    I modified and Simply want to return the average of all salesprices for that year (or better for that grouping like year or quarter)
    Please Login or Register  to view this content.
    Now the subtotal is shown (wrong value but at least one value)

    Actuall its most of the subtotals which are wrong.
    SpotpriceSales (average over year is fine),
    YoYSalesPrice%,(average is fine)
    DeltaSalesYoY(1yr) (must be some of all single monthly results)
    DeltaSalesBase(2020-01) (must be some of all single monthly results)

    Most of them are all linked to the SpotpriceSales i guess.

    Would be great to fix this.

    thanks a lot
    Last edited by hansolu; 03-24-2022 at 10:23 PM.

  7. #7
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: DAX YoY Price change issue if no new price available

    Too many fact table cause too complicate DAX

    Try merge 2 fact tables in to 1 table
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    10-14-2020
    Location
    Shanghai
    MS-Off Ver
    O365
    Posts
    157

    Re: DAX YoY Price change issue if no new price available

    HI

    thanks a lot, works like a charm, thanks a lot.

    I updated the model to add also the supplier and usage of each component of the supplier part. Works also fine.
    I uploaded the new file, just as reference if someone is interessted.

    One question, You made 2 measuers, YoYSale and YoYSale1. I tried to combine them as YoYSale1 is what I want. The result show wrong values then.

    Not a big issue, can just hide the measure in the model.


    Thanks a lot for your help
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Average sales before price change & after price change
    By michts in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-04-2021, 10:32 AM
  2. Replies: 2
    Last Post: 12-05-2020, 05:29 AM
  3. Replies: 3
    Last Post: 10-10-2020, 01:14 AM
  4. [SOLVED] Excel 2013 wants to calculate Sales Price , If cost price exits and wants change SP
    By Bitto in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-13-2015, 12:49 PM
  5. Replies: 3
    Last Post: 01-03-2013, 12:32 AM
  6. [SOLVED] Compare 1 price against multiple prices and change the price according to a formula
    By CharlieAziz in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-16-2012, 11:05 AM
  7. Replies: 4
    Last Post: 08-15-2012, 09:49 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1