I have a dataset where everyday users answer question from a forum if the answer was usefull or not.
So I compute:
- a measure that calculate the total answer by yes: answerYes
- a measure that calculate the total answer (yes or no): answerTot
- a measure that calculate the ratio: answerPercYes= DIVIDE(answerYes,answerTot)
What I need is to compute a moving average over my date dimension (answerDate) on 7 days. How can I accomplish this in PowerBI?
Many thanks!
You could try something like this:
movingAverage:=
CALCULATE(
[answerPercYes]
,DATESINPERIOD(
'answerDate'[Date]
,max('answerDate'[Date])
,-7
,DAY
)
)
Related
In the bank we are using the average price from six vendors. But we now and then entcounter wrong prices due to the fact that one or more vendors some time publish an incorrect price and this affects the average price. I seek inspiration/suggestions to most effecient/correct way and which formula/logic to use to exclude these price outliers. Here below you see an example of the problem. The prices in red text are considered outliers.
Remaining challenge when only three vendors publish a price and when one of these is a outlier. How do I remove/exclude this outlier?
Note: SAND=True and FALSK= False.
Hope someone can help us out. Many thanks in advance ;-)
Kind regards
Soren Sig Mikkelsen
Solution1:
Easiest of way to remove is via defining the inter quartile range...
In below screenshot you can see the formulas with calculated values...
Logic is very simple, calculate the inter quartile range of your data & see if any of the 6 value is outside the upper/lower limit, If so then it's outlier...
Solution2:
Using Average & Std Deviation
Having trouble with my view.
I have 3 columns:
A - total hours worked
B - Total Available Hours
C - Productivity (A/B in a calculated field)
When i click view Grand Totals, the Hours in A and B perfectly align. But the Productivity column, after adjusting measure value to AVG, always shows the average of the fractions in that column, not Total Hours / Total Available Hours in the Grand Total Row. Because of this my %s are slightly off.
I tried looking into LOD as a result but couldn't figure out how to set it up correctly. Hoping to reach out to this community to see if someone can help, since I didnt see a similar post. Thanks in advance!
Hello I have a question regarding some data that I have extracted into Excel. In particular the Market Depth of a Aluminium. I am trying to calculate what the average entry/exit cost would be for a set number of contracts.
I would be very appreciative of any help one could provide.
Example:
I have set the amount to 20. How could i calculate the weighted average entry price? (Assuming we lift the offer ("Buy") and Hit the Bid ("Sell")
I have pasted the format of my data below. I have been using this to limit thew Vol ("Volume") to be the amount i entered where "R4=20 ATM".
=MIN(SUM($G$3:$G$12),$R$4)
I have the following query, intended to calculate for each hour the max value, over a month.
The final result should be- for each parentnode, the hourly max over the last month
I have this for now:
max_over_time((node_memory_MemTotal_bytes{site="fra",parentnode="compute_node"} - node_memory_MemFree_bytes{site="fra",parentnode="compute_node"} - node_memory_Cached_bytes{site="fra",parentnode="compute_node"} - node_memory_Buffers_bytes{site="fra",parentnode="compute_node"} - node_memory_Slab_bytes{site="fra",parentnode="compute_node"})[1h])
Thank you.
You will either have to use subqueries (blog post) or recording rules (example) to first calculate the avg per hour for a month and then max over time for a month.
With subqueries your query would look like this:
max_over_time(avg_over_time(node_memory[1h])[30d:5m])
You can play around with the resolution. But I recommend recording rules once you have worked out your panels
together
somehow my pivot table is currently crashing. The table is structured as follows:
Area, Code and QTY1 are defined by the data model. QTY2, Min and Performance are measures.
QTY2 sums all codes for defined filters from another table. Min calculates the lower value of QTY1 and QTY2.
Measure Performance calculates the ratio of Min to QTY1.
Unfortunately, the sum of Min from Excel will be incorrect. Also, the mean or the sum of performance is also wrong.
Formumlar QTY2: =CALCULATE(SUM(tbl2[QTY]);FILTER(tbl2; tbl2[TYP]<>"11"))
Formular MIN: =MIN([QTY2];[QTY1])
Formular Performance : = [MIN]/[QTY1]
What exactly am I doing wrong?
How can the mistake be avoided?
Edit:
The following approach sums up the right volume for [Min].
But it is not showing the accurate average of 37%. It sums up the divided value.
[Performance]=SUMX(tbl_General;DIVIDE([QTY2];[QTY1];BLANK()))
[Min]=SUMX(tbl_General;(MIN([Qty1];[Qty2])))
Why is that so?
Best regards
Joshua
So this is an example of where SUMX is needed.
You've stumbled on the difference between the aggregation of an expression and the sum of values.
Something like SUMX(dim_Tbl, DIVIDE([MIN], [QTY1], BLANK())) should work
EDIT:
After seeing the edit on the OP, the following measures should work.
Min = SUMX(tbl_General;(MIN([Qty1];[Qty2])))
and
Performance = DIVIDE([QTY2];[Min];BLANK())
In general, 'X' measures are used to iterate over a table and sum the table whereas 'normal' measures are used for recalculations in sums. Your Performance measure you want to recalculate for the total, so don't use SUMX, your Min Measure, you want as a sum of the previous values, so do use a SUMX.