Forum Discussion

fbostan1's avatar
fbostan1
Icon for Helper I rankHelper I
7 months ago
Solved

Day to Day average

Could anyone help me with a measure to find out Day to Day average for Life Total Column in the screenshot below? I' apprecaite your help

thanks!

 

  • Please try the following logic:

    Day to Day % =
    VAR PrevValue =
        CALCULATE (
            SUM ( 'Table'[Life Total] ),
            DATEADD ( 'Table'[Date Run], -1, DAY )
        )
    VAR CurrValue =
        SUM ( 'Table'[Life Total] )
    RETURN
    IF (
        NOT ISBLANK ( PrevValue ),
        DIVIDE ( CurrValue - PrevValue, PrevValue )
    )

10 Replies

  • Please try the following logic:

    Day to Day % =
    VAR PrevValue =
        CALCULATE (
            SUM ( 'Table'[Life Total] ),
            DATEADD ( 'Table'[Date Run], -1, DAY )
        )
    VAR CurrValue =
        SUM ( 'Table'[Life Total] )
    RETURN
    IF (
        NOT ISBLANK ( PrevValue ),
        DIVIDE ( CurrValue - PrevValue, PrevValue )
    )
    • fbostan1's avatar
      fbostan1
      Icon for Helper I rankHelper I

      cengizhanarslan Thank you! that dax worked for this chart, and I wanted to use the same dax on one of the other charts I have in my powerbi dashboard, but it won't work because the column I want to get day to day percentage is written differently.

      here is the Dax for that column:

      here is the chart, I want to get the day to day percentage for the Total Diff column. 

      if I use the same dax you helped me with and replace the Total Securities with Total Diff, that column won't appear. I don't know why, maybe the dax is written differently.

       

    • fbostan1's avatar
      fbostan1
      Icon for Helper I rankHelper I

      cengizhanarslan Hi, 

      your dax formula worked, how can I fill the empty spots. I know why its empty but I don't know how to tweek the dax to get percentage for Monday and Friday.

       

    • fbostan1's avatar
      fbostan1
      Icon for Helper I rankHelper I

      Yes DAX measure, 

      I want to get (Day 2 - Day 1)/Day 1 for the column Life Total. 

      • FBergamaschi's avatar
        FBergamaschi
        Icon for Super User rankSuper User

        OK, assuming you have a model involving a Date table called Date and a column Date in it (Date[Date]), connected to your fact table, you can define this measure

         

        Delta = 
        VAR _LifeTotalCurrentDate = [Life Total]
        VAR _LifeTotalPreviousDate = CALCULATE (  [Life Total], DATEADD ( Date[Date], -1, DAY ) )
        RETURN
        DIVIDE ( _LifeTotalCurrentDate - _LifeTotalPreviousDate, _LifeTotalPreviousDate )

         

        If you are not using a date table, please let me know, in that case I need to see the model tables and the relationships, to link them to how you arranged the visual

         

        If this helped, please consider giving kudos and mark as a solution

        me in replies or I'll lose your thread

        Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

        Consider voting this Power BI idea

        Francesco Bergamaschi

        MBA, M.Eng, M.Econ, Professor of BI