Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Daily growth rate

Hi, I want to calculate daily percentage growth for [Sales Amount] column. Since I'm a newbie, could you help me how to create measured column for that? Many thanks! 

  • Hi,

     

    According to your description, i create a sample to test:

    Please try this measure:

    Measure = 
    var a = IF(MAX('Table'[Date])=MINX(ALLSELECTED('Table'),'Table'[Date]),MAX('Table'[Sales]),CALCULATE(SUM('Table'[Sales]),FILTER(ALLSELECTED('Table'),'Table'[Date]=MAX('Table'[Date])-1)))
    return
    (MAX('Table'[Sales])-a)/a

    The result shows the sales daily increase/decrease:

    Here is my test pbix file:

    pbix 

    Hope this helps.

     

    Best Regards,

    Giotto Zhi

3 Replies

  • With date calendar and Group by the date you can have these measures and their diff

    day =SUM(Sales[Sales Amount]),
    day before = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))

     

    To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
    https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
    https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
    https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

  • v-gizhi-msft's avatar
    v-gizhi-msft
    Icon for Community Support rankCommunity Support

    Hi,

     

    According to your description, i create a sample to test:

    Please try this measure:

    Measure = 
    var a = IF(MAX('Table'[Date])=MINX(ALLSELECTED('Table'),'Table'[Date]),MAX('Table'[Sales]),CALCULATE(SUM('Table'[Sales]),FILTER(ALLSELECTED('Table'),'Table'[Date]=MAX('Table'[Date])-1)))
    return
    (MAX('Table'[Sales])-a)/a

    The result shows the sales daily increase/decrease:

    Here is my test pbix file:

    pbix 

    Hope this helps.

     

    Best Regards,

    Giotto Zhi

    • Anonymous's avatar
      Anonymous
      Not applicable

      Good day,

       

      I trust this message finds you well.

       

      Please note I have created the measure as per your script however on my side the % is incorrect.

       

      Please see screenshot below

       

      Previous day figure is 3 542, current day is 3 940. therefore (3 940-3 542)/ 3 542 = 11% however I am getting -0.99. 

       

      Please assist....Im not understanding why I am getting the incorrect figure. Thanks