Open Office find all bills labelled POWER and work average cost - if-statement

So I have made a spreedsheet to help me keep track of my power and gas bill - well the total cost of the bill anyway. This way as the months go on I am able to see what the average Power and Gas bill have been.
I am using only sheet1 and prefer to do it this way, so when I show my partner they don't need to flick through pages of numbers. It's right in front of them with Power & Gas in the next row - take a look at the image below.
So as you can see from the above (not including the J3 row) I have everything laid out in the layout I would like. This way when I get a bill emailed to me I add it, and then I can pay X amount and record that.
I know how to do =sum() and =average() but how can I limit it to only the power rows automatically.
The query should be looking up G column for power or gas and then whichever one it is get the H column next to it and then work out the cost per month by looking at the date the bill came out.
Power bill is every month so that easy, gas is every 3 months.
I know in open office they have the =if() command and I made it return TRUE when it was power but it does not seem that i can use just that function? I am wondering if maybe a TUT or example that outlines how we get the result like this.
Another example would be replace gas and power with tech toys i.e batteries over a year what was the real cost per monthly.

Ok after thinking outside the square - the answer I am using is this.
=AVERAGEIF(G3:G100;"POWER";H3:H100)/COUNTIF(G3:G100;"POWER")
I divided power by it's count as we get it every month
=AVERAGEIF(G3:G100;"GAS";H3:H100)/COUNTIF(G3:G100;"GAS")/3
I divided gas by 3 as we get it every 3rd month

Related

How to create a measure so that I can use a card visual to show number of stores who are selling an average of N Products per month

I am trying to put together a report in which I have 2 card visuals (for two separate years) that show the total number of stores that sell at least an average N of products each month.
The measure I tried making in Dax finds average sold by year, but would I also need to take store into account there within the measure?
Either way the Card visual wont let me filter by my measure
Here is a very simplified version of the data: Sample Dummy table
Essentially wanting to show one card that shows the number of stores that are averaging at least 2 sales per month so far this year. And one that shows the same metric to this point in the prior year
I also have my table linked to a calendar table

How to divide project hours over project length with a known end date in Power BI

I'm trying to figure out how to spread the estimated hours for a project over the length of that project with a known end date.
Example, I have Project 001, it is 600 hours, and it is a six-month project that is due to release June 2020. Each of these values (project identifier, hours, length, and release date) are separate columns in a database.
In this example, Project 001 would add 100 hours to each month from January to June. If Project 002 had 300 hours with the same length and release date, now each month would have 150 hours.
The end goal is to get a forecast of how many hours we expect in each month for all the projects we have to determine the overall capacity demands for the month. So we'd have something like a bar chart that shows the total hours demand for each month based on the projects that will impact that month. Or we'd have a bar chart that shows the remaining capacity (fixed monthly capacity minus monthly estimated hours).
I haven't been able to determine how to generate something that will divide the hours backward over the length of the project based on the project end date. I'm still pretty new to Power BI, so I could do with some guidance on this one. I'm well versed in Excel and VBA, I understand the basics of creating measures and some of the ways Power BI "formulas" are written. Any help is much appreciated.
I made a small test table:
I added the column: HoursPerDay
HoursPerDay = Hours[Hours]/ DATEDIFF(Hours[StartDate];Hours[EndDate];DAY)
Next I made a calendar table:
Calendar = CALENDAR(MIN(Hours[StartDate]);MAX(Hours[EndDate]))
I added the measure HoursPerProject to this table:
HoursPerProject = CALCULATE(SUM(Hours[HoursPerDay]);FILTER(Hours;Hours[StartDate] <= VALUES('Calendar'[Date]) && Hours[EndDate] >= VALUES('Calendar'[Date])))
This is the important bit because it checks if it should include the hours for a prject on that day.
When putting this in a stacked column graph, you need to place the HoursPerProject in the value and the Date of calendar on the Axis. Hope this helps you.

How to measure average sales using working days?

I'm using Power Bi desktop to create a sales dashboard, and ran into a small code issue.
I need to calculate average sales in a period of working days, and tried:
TOTALYTD([Sales];
dimCalendar[Date];
dimCalendar[WorkingDays]<=16)
16 is the related working day for 22APR2019 in Brazil.
After that I plan to divide it by a month count or another similar method.
The hard coded 16 works very well, however when I try to use another formula instead:
TOTALYTD([Sales];
dimCalendar[Date];
dimCalendar[WorkingDays]=CALCULATE(MAX(dimCalendar[WorkingDays]);
LASTDATE(dimCalendar[Date])
))
It gives an error that I can't use calculate in a true/false expression.
I tried to use calculated column, but doesn't work as well.
Do you have any idea of how I can create this measure?

Calculate rates from previous month based on current month in order to make then visually comparable

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.

Power BI Percentage of Month passed

I would like to create a calculated column or measure that shows the time elapsed in any given month. Preferably as a percentage.
I need to be able to compare productivity (rolling total) over a month's period between different months.So creating a percentage of time passed in a month would put every month on a level playing field.
Is there a way to do this?
Or is there a better way to compare productivity between 2 months on a rolling basis?
EDIT
I am graphing sales on a cumulative basis. Here is a picture of my graph to demonstrate.[][
Ideally I would like to be able to graph another person's sales on the same graph for a different month to compare.
The problem is each month is different and I don't think power bi allows much customization of the axes.
So I figured a potential solution would be to convert months to percentages of time passed, create two separate graphs and place them on top of each other to show the comparison of sales.
Using percentages doesn't sound right here: one person's "productivity" in February will appear lower than another person's productivity in March just because February has 3 less days.
Just use [Date].[Day].
To answer the original question (even though it shouldn't be used for this), month progress percentage calculated column:
MonthProgress% =
var DaysinMonth = DAY(
IF(
MONTH(MyTable[date]) = 12,
DATE(YEAR(MyTable[date]) + 1,1,1),
DATE(YEAR(MyTable[date]), MONTH(MyTable[date]) + 1, 1)
) - 1
)
return MyTable[date].[Day]/DaysinMonth*100
Also check DAX functions PARALLELPERIOD and DATEADD.
This is the solution I settled on.
I customized the ranges for the x and y axes so they match.
For the y-axis, I simply put the range from 0 to 50+ our highest month.
For the x-axis, I created a column with the DAY function so I got a number assigned to each day of the month which allowed me to manually set the chart range from 0 to 31. I have asked another question on how to only get workdays.