i am trying to write a query in order to track penalty in case of KPI failure. eg. if in month of Oct my PI is failed 98% i get a retention if fail again following month not i get another retention i get deduction. In case one month its 98% and next month i pass i get money back.
below is the formula in excel need to change them in DAX any suggestions please.
how to translate below formulas in DAX, as my dax knowledge is limited
Frist month retention formula =IF(AND(F4>=0.98,F4<1),E4,"") **following month deduction ** =IF(AND(F5<1,F5>=0.98,J5<1,J5>=0.98),E5,IF(AND(J5<0.98,F5<0.98),I5,IF(AND(F5<1,F5>=0.98,J5<0.98),E5+I5,IF(AND(F5=1,J5<0.98),I5,""))))
refund of retention in case of pass =IF(AND(N5=1,J5<1,J5>=0.98),-K5,IF(AND(N5<1,N5>=0.98,J5<1,J5>=0.98),M5,IF(AND(J5=1,N5<1,N5>=0.98),M5,IF(AND(J5<0.98,N5<1,N5>=0.98),M5,""))))
Related
i am trying to write a query in order to track penalty in case of KPI failure.
eg. if in month of Oct my PI is failed 98% i get a retention if fail again following month not i get another retention i get deduction. In case one month its 98% and next month i pass i get money back.
below is the formula in excel need to change them in DAX any suggestions please.
Frist month retention formula =IF(AND(F4>=0.98,F4<1),E4,"")
**following month deduction ** =IF(AND(F5<1,F5>=0.98,J5<1,J5>=0.98),E5,IF(AND(J5<0.98,F5<0.98),I5,IF(AND(F5<1,F5>=0.98,J5<0.98),E5+I5,IF(AND(F5=1,J5<0.98),I5,""))))
refund of retention in case of pass =IF(AND(N5=1,J5<1,J5>=0.98),-K5,IF(AND(N5<1,N5>=0.98,J5<1,J5>=0.98),M5,IF(AND(J5=1,N5<1,N5>=0.98),M5,IF(AND(J5<0.98,N5<1,N5>=0.98),M5,""))))
I am working on a forecasting graph that will be pulling in data from SQL through power query. The graph will have slicers and filters available to the user to analyze different populations. I am currently being asked to provide a rolling average for each day of the next month but will update daily as more data becomes available. I need 30 days of rolling average that occur after the current date. Using the prior days rolling average calculation. This has to be completed in dax to allow the filters and slicers to work appropriately. The rolling average looks 14 days back.
Any ideas on how to best proceed would be greatly appreciated.
Below is a table of data to show how this looks in excel:
Power Bi gives you the option to look at data by Year, Quarter, Month, and Day. I want the ability to look at data by 7 day periods that start on a specific date (not necessarily Monday or Sunday). How is the best way to accomplish this? I am guessing it will be with a measure but I can't quite figure out what the measure should look like?
Here I know I can assign a day of the week to each row and then use Week Day on my date axis. My problem is I need to be able to put "Tuesday" in the second parameter instead of either 1. Sunday or 2. Monday.
Week Number = WEEKNUM(Sheet1[Date],2)
Thank you in advance!
IIUC, the following might work:
Week number = WEEKNUM(DATEADD([Date],1,DAY),2)
I am trying to do some time based calculations on my budgeting data but struggling to understand where I'm going wrong or if my data structure would even support what I'm trying to do.
As per the image above, this is my raw data. ie. A monthly budgeted and actual total for each cost centre that is being imported from an excel spreadsheet.
I am trying to calculate a YTD budget and YTD Actual figure per cost centre based on the monthly totals. Ideally I would like all of this data displayed in a table that I can then use slicers to segment/pivot.
When using the CALCULATE() function in a measure, I am unable to select my cell value for each date and cost centre.
eg.
YTD Actual = CALCULATE( [Actual MTH] , DATESYTD('Dates'[Date], "30/6"))
returns the error
The value for 'Actual MTH' cannot be determined. Either 'Actual MTH'
doesn't exist, or there is no current row for a column named 'Actual
MTH'.
Any assistance with getting a greater understanding of the issue here would be appreciated.
Thanks
Try something like this for your measures:
YTD Actual = TOTALYTD(sum([Actual MTH]),'Dates'[date],ALL('Dates'[date]),"30/6")
Maybe this is an easy one but since I’m very new in DAX and PowerBI I can’t figure it out. My database has daily data ranging from MAY/17 to JUN/17 (and it’ll still going in the future). It has information of DATE, DAY, YRMTH (year-month), QT_APRV (approved customers) and QT_TOTAL (total consumers). Sample below (using Excel just to be quicker):
I wanted to create in PowerBI a bar chart with QT_TOTAL per day and a line chart with approved rate of consumer. For the rate, I used:
APPRV_RT = SUM(database[QT_APRV]/SUM(database[QT_TOTAL])
And then, selecting only a month by time in the chart (just like I want), I have:
Perfect, but now I want to create a new line chart, showing the approved rate in each respective day of the last month. Using my example, when june data are select, the first line chart has to show the daily approved rate of june AND the other the approved rate of may, in order to make it comparable (june1 -> may1; june12 -> may12 and so on). Here’s what I want:
How to make this automatically, in order to make each month comparable with the previous? I thought about some DAX formula involving a sum with filtering current month minus 1, I don’t know how to do it.
Any ideas?
UPDATE (07/08/2017)
I tried what Rasmus Dybkjær suggested me, and I thing I'm in the right path.
APPROVED_RATE_PREVIOUS_MONTH = CALCULATE([APPROVED_RATE_CURRENT_MONTH];PARALLELPERIOD(dCalendario[DataBase];-1;MONTH))
However, it returned the approved rate from the previous month as a whole (67,0% in May), not each day as I wanted:
Any suggestions?
You should be able to use the DAX function called PARALLELPERIOD() for this purpose. The PARALLELPERIOD() function takes a date column and shifts it a number of periods back or forward.
For example, you could use it like this to calculate your approved rate shifted one month back:
ApprovedRateLM =
CALCULATE(
DIVIDE(
SUM(database[QT_APRV]),
SUM(database[QT_TOTAL])
),
PARALLELPERIOD(database[Date],-1,month)
)
Note that it is important that your [Date] column contains a date type. Otherwise the PARALLELPERIOD function will not work.