Forum Discussion
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
- cengizhanarslan
Super User
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
Helper 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
Helper 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.
- FBergamaschi
Super User
Hi fbostan1,
I am assuming Life Total is a DAX measure, am I correct?
Can you please explain what you mean by "Day to Day average" ?
Thanks
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
- fbostan1
Helper I
Yes DAX measure,
I want to get (Day 2 - Day 1)/Day 1 for the column Life Total.
- fbostan1
Helper I
- FBergamaschi
Super 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