Remove some totals in power BI - sum

I'm pretty new in Power BI, I have a table with 6 columns, the last row obviously is the total with the sum / mean of the rows. I just need to remove 3 of the 6 totals. I mean I want that there is a blank/empty string. How can I do that?
I want to remove the 3 values in the picture. I hope this is a easy task.
thank you

You can use function HASONEVALUE( columnName) with if. if (HASONEVALUE('Table'[SomColumn], 'then your calculation', BLANK() )

Related

SSRS insert exact specific value in a cell of a Matrix using expression

I'm not sure if my question is really stupid, but I found nothing on the internet...
Is it possible to insert a specific value in a cell of a matrix?
for example I have a dataset like below:
Month Prod Amount
2 X 34$
11 Y 12$
7 Z 150$
and a matrix like:
-------| Month |
Prduct |SUM(Amount)|
So the row group are products and column group are the months of a specific year.
If I want to add an extra column, with a specific value chosen dynamically from the amount (for xample 150$) so to have
-------| Month |columnName
Prduct |SUM(Amount)| 150
is that possible? also if the value is repeated through the column (it would be useful if I wanted the new column to have this specific value added for each value)
thanks a lot!! :D
You can insert a value directly in your matrix but it will be repeated for each record.
The best way is to add a new column with conditional values is to do this in your dataset query. Probably with a CASE statement if you are using SQL.
EDIT: If you can't adjust the query for whatever reason, you can add the new column and use SWITCH function inside your textbox to achieve the same.

How to combine a row of cells in VBA if certain column values are the same

I have a database where all of the input from the user (through a userform) gets stored. In the database, each column is a different category for the type of data (ex. date, shift, quantity, etc) and the data from the userform input gets put into its corresponding category. For some of the data, all the data is the same except for the quantity. I was wondering how I could combine these rows into one and add the quantities to each other for the whole database (ex. combining the first and third data entries). I have tried playing around with a couple different loops but can't seem to figure anything out.
Period Date Line Shift Type Quantity
4 x 2 4/3/18 A 3 14 18
4 x 2 4/3/18 A 3 13 12
4 x 2 4/3/18 A 3 14 15
Thank you!
If you're looking to modify the underlying database, you might be able to query the data into the format you want by including all the other columns in a GROUP BY statement, save the result to another table, then replace the original table with the properly formatted one.
If you have the data in Excel and you just want to view it with the duplicate rows summed, a Pivot Table would be a good choice. You can select all the other columns as rows for the Pivot Table and sum of Quantity as the values.

Excel VBA data manipulation

My problem might be simple but i have been stuck on it for a while. I have a list of accounts in column B (XXXXXX). Then in column D i have a quantity of contracts traded. In the column E i have the prices of those contracts. The column next to it has the name of the product traded.
The way i get the raw data i sometimes get a trade split in 2 parts. For example i might have on one row for the same (column B) account XXXXXX , QTY(Column D) 2 and Price(column E) 5.23$ and security(column F) NKE. In the next row i have the same account XXXXX , QTY is 3 , Price is same and the security is same. I want something that will loop through the entire data and add the QTY to 5 and keep everything else the same. So at the end i should have one row with with account XXXXXX with QTY 5 Price 5.23$ and Security NKE. I have tried pivot tables but it adds the price of the security to 10.46$ and that messes up calculations. I cannot figure what sort of a macro i should use. Can someone please help. I am posting a picture to help understand the problem. THanks. enter image description here
A pivot should show you what you want. Don't put Price in VALUES. Account, Security and Price can go in ROWS then Sum of Quantity in VALUES. That should give you the breakdown you're after.
Choose the most unique column (probably F).
Filter your data by this column.
Make an infinite loop. Inside the loop:
declare a variable for row number
check if the current row has the same value in column F as the row below
if yes, add quantities in first row and delete second row
if no, add one to row number and check if there is something in the current row. If no, exit the loop.
To the person who posted a macro. Can you please repost? I was just writing a note to you and I see you deleted the comment

Average Distinct Values in a single column in Power Pivot

I have a column in PowerPivot that basically goes:
1
1
2
3
4
3
5
4
If I =AVERAGE([Column]), it's going to average all 8 values in the sample column. I just need the average of the distinct values (i.e., in the example above I want the average of (1,2,3,4,5).
Any thoughts on how to go about doing this? I tried a combination of =(DISTINCT(AVERAGE)) but it gives a formula error.
Thanks!!
Kevin
There must be a cleaner way of doing this but here is one method which uses a measure to get the sum of the values divided by the number of times it appears (to basically give the original value) then uses an iterative function to do it for each unique value.
Apologies for the uninspired measure names:
[m1] = SUM(table1[theValue]) / COUNTROWS(Table1)
[m2] = AVERAGEX(VALUES(Tables1[theValue]), [m1])
Assuming your table is caled table1 and the column is called theValue

Dynamic use of MDX AVG function

Anyone have advice on how to build an average measure that is dynamic -- it doesn't specify a particular slice but instead uses your current view? I'm working within a front-end OLAP viewer (Strategy Companion) and I need a "dynamic" implementation based on the dimensions that are currently filtered in the data view.
My fact table looks something like this:
Key AmountA IndicatorA AmountB Other Data
1 5 1 null 25
2 6 1 null 52
3 7 1 2 106
4 null 0 4 108
Now I can specify a simple average for "[Measures].[AmountA]" with "[Measures].[AmountA] / [Measures].[IndicatorA]" which works great - "[IndicatorA]" sums up to the number of non-null values of "[AmountA]". And this also works great no matter what dimensions are selected in the view - it always divides by the count of rows that have been filtered in.
But what about [AmountB]? I don't have a null indicator column. I want to get an average value of [AmountB] for whatever rows have been filtered in for my current view. If I try to use the count of rows as a simple formula (psuedo-code "[Measures].[AmountB] / Count([Measures].[Key])") I get the wrong result, because it is counting all the null rows in the average.
So, I need a way to use the AVG function to specify the average of [AmountB] over the set of "whatever rows I'm currently filtering in, based on whatever dimensions I'm currently using". How do I specify this dynamic set?
I've tried several different uses of the AVG function and they have either returned null or summed up to huge numbers, clearly not the average I'm looking for.
Thanks-
Matt
Sorry, my first suggestion was wrong. If you don't have access to OLAP cube you can't write any mdx-query for this purpose (IMHO). Because, you don't have any detailed data (from your fact table) in this access level and you can use only aggregated data and dimensions from your cube.
Otherwise (if you have access to olap db), you can create this metric (count of not NULL rows) in your measure group and after that use it for AVG calculation (as calculated member in your cube or in section "WITH" in your mdx-query).