Sum of Calculated Column - powerbi

I have calculated column Importance_Weight of which I need to create measure that sum questions for related line number.
Importance_Weight = (ColumnX * Average(ColumnY) )/100
Calculated column values for each question is correct as below but when aggrigated by line number the sum is wrong as blow
I used following measure to calculate sum of questions (q) i.e. L1
LT_WeightPerQuestion:=SUMX(DimQuestion, AVERAGE(Survey[Importance_Weight]))
Thanks in advance.

Use measure as below
LT_WeightPerQuestion = SUM(Survey[Importance_Weight])

Related

Sum the Column A Only if Column B contains?

I have the table in google-sheets which looks:
I need to sum sums according to the Card = "HDFC"
i.e need to display in cell 1408.8
Need help here.
I Tried:
=COUNTIF(C3:C1000,"HDFC")
but its give count only not sure how to use to get sumif on column B if matches column C
Simple SUMIFS() must work. Try-
=SUMIFS(B4:B,C4:C,E4)
or these:
=SUM(FILTER(B:B; C:C="HDFC"))
=INDEX(QUERY(B:C; "select sum(B) where C = 'HDFC'"); 2)

New column to divide a 'grouped sum' by a 'grouped count'

I am trying to do something very simple, but I can't.
I want to divide the USD Value by the number of projects (which is a grouped value/a calculated field/a count of all projects by an operator) to get an 'Avg. project value by operator'.
I've tried
> Avg. project value by operator = DIVIDE(SUM(df[Value Million U S
> D]),COUNT(df[Project Id]))
but I don't get a correct result.
Any help appreciated.

PowerBI empty values row not displayed

I have a confusing mystery...
Simple DIVIDE formula works correctly. However blank rows are not displayed.
I attempted a different method using IF, and now the blank row is correctly displayed.
However this line is only displayed if I include the IF formula (which gives a zero value I don't want).
Formula 1:
Completion % =
DIVIDE(SUM(Courses[Completed]),SUM(Courses[Attended]),BLANK())
Formula 2:
Completion % with IF =
IF(SUM(Courses[Attended])=0,0,DIVIDE(SUM(Courses[Completed]),SUM(Courses[Attended])))
With only the DIVIDE formula:
Including the IF formula:
It appears that Power BI is capable of showing this row without error, but only if I inlude the additional IF formula. I'm guessing it's because there is now a value (0) to display.
However I want to be able show all courses, including those that have no values, without the inaccurate zero value.
I don't understand why the table doesn't include these lines. Can anyone explain/help?
The point is very simple, by default Power BI shows only elements for which there is at least one non-blank measure.
The DIVIDE operator under-the-hood execute the following:
IF(ISBLANK(B), BLANK(), A / B))
You can change its behaviour by defining the optimal parameter in order to show 0 instead of BLANK:
DIVIDE(A, B, 0) will be translated in the following:
IF(ISBLANK(B), 0, A/B))
Proposed solution
Those mentioned avobe might all be possible solutions to your problem, however, my personal suggestion is to simply enable the option "show item with no data" in your visualization.
While DIVIDE(A, B, 0) will return zero when when B is zero or blank, I think a blank A will still return a blank.
One possibility is to simply append +0 (or prepend 0+) to your measure so that it always returns a numeric value.
DIVIDE ( SUM ( Courses[Completed] ), SUM ( Courses[Attended] ) ) + 0

Adding a range of cells to one cell based on a condition

I have a sheet in Ms Excel with Loan details, where the loan status is either 'Paid' or 'Unpaid'. For every row, I want to add the amount value to cell C18 if the corresponding cell in status column reads "Unpaid".
eg. for row 10,
=IF(J10 ="Unpaid", $C$18+G10, $C$18+0) **{This does not work}**
How can I achieve this so as to use the formula for a couple of rows?
You might try ...
=C$18+(J10="Unpaid")*G10
This formula will add C18 to G10, but only if J10 says "Unpaid", otherwise, it will just add C18 to 0.
It can be "dragged down" for the other rows, and the '$' on C$18 will keep that cell fixed while the references for J and G will correspond to the row that the formula is in.
My guess from what you're saying is that you want to add column G only when the corresponding value in column J = "Unpaid".
If so, the formula you put in C18 is =SUMIFS(G:G,J:J,"Unpaid") or =SUMIFS(G10:G,J10:J,"Unpaid") if you want to start the sum at row 10.
You can't add to $c$10, only to a new column, lets say called 'balance'. There (column k) would be the formula =$k9+if($j10="Unpaid",$g10,0)
in Google Sheets:
=ARRAYFORMULA(IF(J10:J50="Unpaid"; C18+G10:G50; C18))

How to count the number of blank cells in one column based on the first blank row in another column

I have a spreadsheet set up with tv program titles in column B, the next 20 or so columns are tracking different information about that title. I need to count the number of blank cells in column R relating to the range in column B that contains titles (ie, up to the first blank row in column B.)
I can easily set up a formula to count the number of empty cells in a given range in column R, the problem is as I add more titles to the sheet I would have to keep updating the range in the formula [a simple =COUNTIF(R3:R1108, "")]. I've done a little googling of the problem but haven't quite found anything that fits the situation. I thought I would be able to get the following to work but I didn't fully understand what was going on with them and they weren't giving the expected results.
I've tried these formulas:
=ArrayFormula(sum(MIN("B3:B"&MIN(IF((R3:R)>"",ROW(B3:B)-1)))))
=ArrayFormula(sum(INDIRECT("B3:B"&MIN(IF((R3:R)>"",ROW(B3:B)-1)))))
And
=if(SUM(B3:B)="","",SUM(R3:R))
All of the above formulas give "0" as the result. Based on the COUNTIF formula I have set up it should be 840, which is a number I would expect. Currently, there are 1106 rows containing data and 840 is a reasonable number to expect in this situation.
Is this what you're looking for?
=COUNTBLANK(INDIRECT(CONCATENATE("R",3,":R",(3+COUNTA(B3:B)))))
This counts the number of non-blank rows in the B column (starting at B3), and uses that to determine the rows to perform COUNTBLANK in, in column R (starting at R3). CONCATENATE is a way to give it a range by adding strings together, and the INDIRECT allows for the range reference to be a string.
a proper way would be:
=ARRAYFORMULA(COUNTBLANK(INDIRECT(ADDRESS(3, 18, 4)&":"&
ADDRESS(MAX(IF(B3:B<>"", ROW(B3:B), )), 18, 4)))
or shorter:
=ARRAYFORMULA(COUNTBLANK(INDIRECT("R3:"&
ADDRESS(MAX(IF(B3:B<>"", ROW(B3:B), )), 18, 4))))
or shorter:
=ARRAYFORMULA(COUNTBLANK(INDIRECT("R3:R"&MAX(IF(B3:B<>"", ROW(B3:B), ))))