Rolling Average of a Measure - powerbi

I'm trying to find a 30-day rolling average of a measure [STORY COMPLETED]
The measure is calculated as:
STORY COMPLETED = CALCULATE(COUNT(SprintReportIssues[SPRINT_REPORT_STATUS]), SprintReportIssues[SPRINT_REPORT_STATUS] = "COMPLETED")
SPRINT_REPORT_STATUS can be one of four values: "COMPLETED", "COMPLETED OUTSIDE", "INCOMPLETED" or "REMOVED"
If you look at the image, I want something like:
Rolling Average Throughput of top row to be 19+18+13/3
Rolling Average Throughput of second row to be 18+13+14/3
Rolling Average Throughput of second row to be 13+14+9/3 and so on
enter image description here
Note: all data is on the SprintReportIssues table
I expect a DAX measure for Power BI, and I've tried using AVERAGEX, but I don't seem to be getting it right

This measure will solve your problem:
Rolling Average Throughput =
VAR __LAST_DATE =
LASTDATE('Table'[START DATE])
RETURN
AVERAGEX(
DATESBETWEEN(
'Table'[START DATE],
DATEADD(__LAST_DATE, -28, DAY),
__LAST_DATE
),
[STORY COMPLETED]
)

Related

Calculate rolling total for calculated measure in powerBi

I have calculated measures for total Hrs and quantity with that I calculated (Hrs/Qty), and now I need to calculate running total of that.
Expected result: 6.18,7.52 and so on. But it's giving incorrect result. What's is the correct Dax formula? Can we calculate rolling total for calculated measure?
Power BI has a Quick Measure Running Total that is provided for exactly this purpose. And of course, you can also use Measures as Base Value for the calculation.
Please try this measures to achieve your goal:
% Of HR = SUMX(YourTable,DIVIDE([HR],[Qty]))
Rolling Total = CALCULATE(
[% Of HR],
FILTER(
ALL(YourTable[Week End Date]),
YourTable[Week End Date] <= MAX(YourTable[Week End Date])
)
)
If we test our measure on a visual:

Measure using datetime in Power BI

I have a table like in the attached image:
As you can see, I have power consumptions of houses by hour.
What I would like to do is create a measure to calculate the average of power consumption by day and other measure to sum this average of power consumption by days depending on a time interval introduced in a filter.
I know it could be easy by don't know how to start with this.
Thanks for your help!
Regards
Start by adding Calculated columns for Date and Time only:
Date = DATEVALUE(FORMAT('Table'[Datetime], "YYYY-MM-DD"))
Time = TIMEVALUE(FORMAT('Table'[Datetime], "hh:mm"))
With this you create a new Calculated table for consumption per day
Consumption per day =
SUMMARIZE(
'Table',
'Table'[Date],
"Avg. Consumption", AVERAGE('Table'[Consumption])
)
and consumption per day for a given time interval
Consumption per day and time interval =
CALCULATETABLE(
SUMMARIZE(
'Table',
'Table'[Date],
"Avg. Consumption", AVERAGE('Table'[Consumption])
),
'Table'[Time] >= TIMEVALUE("00:00"),
'Table'[Time] <= TIMEVALUE("01:00")
)

DAX - RT Measure calculation based on specific selected date in slicer

i have a problem regarding my calculation. I want to visualize the running total over time (for example 01.07 after hours rounded to the nearest half hour to reduce computing power). I have 90 days of data in my dataset. The Problem i have is that the calculation for the dates long time ago (for example 01.12.2021) are super fast and the calculation for recent dates (05.07.2022) are super slow. I think that the measure calculates the running total for the whole column and then the date filter will be applied, which caused the extreme long calculation time for recent dates. Every day has the same amount of rows. Any idea how i can tell the measure to calculate the running total only for the selected date/date which i picked in my filter?
I used the following measures:
Average Sales =
'Measure Table X'[RT Sales] / 'Measure Table X'[RT Rows]
RT Sales = CALCULATE(
Sum('X'[Sales]),
'X'[Time rounded] <= Max('X'[Time rounded]))
RT Rows = CALCULATE(
COUNTA('X'[Time rounded]),
'X'[Time rounded] <= Max('X'[Time rounded]))```
I'm not sure what you are going to achive, but you can try this, this can work faster.
Average Sales =
CALCULATE(
DIVIDE('Measure Table X'[RT Sales] , 'Measure Table X'[RT Rows])
'X'[Time rounded] <= Max('X'[Time rounded]
)
RT Sales = Sum('X'[Sales])
RT Rows =COUNTA('X'[Time rounded])

Measure Not Totaling Correctly

I have a measure that is comprised of other measures. I will post below pictures. I am calculating the forecast for the month per location. I created a measure for that and the total is correct for that. I created another measure that calculates the working days in a month and when I divide by this measure, I get the correct results per the location but the total is wrong.
This measure shows the measure I am using to calculate the total forecast for the month per location.
"MPP = (CALCULATE(SUM('TF'[ Forecast ]), DATESBETWEEN ('TF'[Date],[Month Start-pp], [Month end_pp] )))"
This measure shows the measure I am using to calculate the working days in a month.
"Days per location =
CALCULATE (
COUNTROWS ( 'TF' ),
FILTER (
'TF',
'TF'[Date].[MonthNo] = MONTH ( TODAY () )
)
)"
The pic is showing the totaling. The first column is the measure without the division and is correct totaling. The second column is where the issue is.

Calculate Rolling Day Total in PowerBI/Dax

I have a table in PowerBI that has the column "Date" and "Sales". I want to create a measure and display it in a table that computes a rolling 7 day total of the "Sales" column. To be clear, I want to see this overtime, I do not want it for a single day, I want to create a table exactly like I am showing below, thanks!
Rolling total can be make using the quick measure feature underneath the New Measure & New Column buttons in the Home Tab.
Select Calculation -> Rolling Total in the Totals Section
If not then you can make a formula (Both for Measures):
Rolling Total =
CALCULATE(
SUM('Sheet1'[Sales]),
FILTER(
ALLSELECTED('Sheet1'[Date]),
ISONORAFTER('Sheet1'[Date], MAX('Sheet1'[Date]), DESC)
)
)
Rolling Total 2 =
CALCULATE(
SUM(Sheet1[Sales]),
DATESMTD(
Sheet1[Date])
)