Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Previous Day Value Calculation

Hi,

I am trying to do two things here:

 

  1. ascertain the change in AttatchmnetRate% (this is a calculated measure) over the previous day
  2. If this change is more than negative -2% over the previous day format the cell to show red

 

So for EG:

the attatchement rate % change should show me -0.36% on October 5 (66.07 - 65.71)

then the attatchement rate % chagne should show me  -2.56% on October 6 ( 65.71 -63.15)

 

  • Hi, Anonymous 

     

    You can try the following methods.

    AttatchmnetRate%  is a calculated measure.

    Previous day% = CALCULATE([AttatchmnetRate%],FILTER(ALL('Table'),[Date]=SELECTEDVALUE('Table'[Date])-1))
    Change = IF([Previous day%]<>BLANK(),[AttatchmnetRate%]-[Previous day%])
    Color = IF([Change]<=-0.02,"Red")

    Result:

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • v-zhangti's avatar
    v-zhangti
    Community Support

    Hi, Anonymous 

     

    You can try the following methods.

    AttatchmnetRate%  is a calculated measure.

    Previous day% = CALCULATE([AttatchmnetRate%],FILTER(ALL('Table'),[Date]=SELECTEDVALUE('Table'[Date])-1))
    Change = IF([Previous day%]<>BLANK(),[AttatchmnetRate%]-[Previous day%])
    Color = IF([Change]<=-0.02,"Red")

    Result:

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      thanks... explained in an easy step by step manner and easy to understand.. 

  • Anonymous , With help from date table, You can try measures like examples 

     

    This Day = CALCULATE(sum('Table'[Qty]))

    This Day = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])))


    Last Day = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])-1))
    Last Day = CALCULATE(sum('Table'[Qty]), previousday('Date'[Date]))

     

    diff =[This Day] - [Last Day]

     

    Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
    https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4
    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 :radacad sqlbi My Video Series Appreciate your Kudos.