Power BI Matrix - Only Show Subtotals for Numeric Values - powerbi

Fairly new to Power BI, trying to replicate SSRS reports but am struggling with what in SSRS would be really simple.
I have a matrix which has subtotal rows for the "groups". Some of the values in the matrix are text values rather than numbers. I want to remove the text "subtotals" from the subtotal row, but can only see how to remove the entire row.
For example, I have a value called Deal Type which can hold Growth, Primary or Secondary so in the subtotal row, I am seeing Growth, where I actually don't want to see anything.
We are evaluating Power BI for our business and it seems one day we find something that we love and then next day, a bunch of minus points.
Thanks for your help
EDIT
As you will see, for the subtotal and total rows, I don't want to see Primary, France, and EUR but I do want the values of the numeric columns.
Unrealized and CompanyName are used as the Rows, for security reasons can't show the Company Names.
Hope that helps

It's hard to give a precise answer without any visibility of your actual data structure... But it sounds like you need to create a measure, something like:
=IF (
HASONEVALUE ( MyTable[Group Item] ),
FIRSTNONBLANK ( MyTable[Deal Type], 1 ),
BLANK ()
)

Related

How do I get my rank column to refresh as I filter my other data columns?

Hello Stack Overflow community -- I am looking for a solution on how to filter my table on the REPORT tab (i.e. I want to avoid using the "Transform Data" function) and have my rank column on my report tab update as I make filter adjustments.
Right now, for example, when I filter out specific products from my product column, the corresponding rank column does not update along with it.
Visual example:
product
rank
apples
1
oranges
2
What I want to happen is if I filter out "apples" from my PRODUCT COLUMN, I want the RANK COLUMN to show "oranges" as rank #1. Now, when I filter out "apples", the rank column shifts all my data up, but oranges and the data that follows is stuck with its old rank
EDIT: I also want to know if I can filter my product column and have other columns dynamically update/refresh as well, such as Cumulative %, Market Share, and so on -- things that will require updates if the input data shifts.
Thank you!
Tried creating filters on the report tab, but columns like rank, cumulative %, market share, etc do not refresh with new rankings etc
PowerQuery columns and DAX calculated columns are updated on data refresh only. If you want the report to react on slicers/filters, you need to use measures, like
Rank Measure =
RANKX(
ALLSELECTED( example ),
CALCULATE( MIN( example[product] ) ),
,
ASC,
DENSE
)
This is also the reason why all data analysis should be done in DAX, not PowerQuery. So, you'll have to rebuild your Cumulative % or Market Share calculation as DAX measures, if you want to see the impact of filters and especially cross-filters, which is the very power of Power BI.
Accept this answer, if it was helpful to solve your problem. If not, comment why!

Is DAX from Power BI same as LOD in Tableau

I'm new to tableau. my question is, is DAX from Power BI same as LOD in Tableau?
It'd be great if someone could help me with an explanation for this.
thanks in advance!
There are similarities for sure. In Excel it can be a way to display a value that is unaffected by filtering.
LODs are similar in that you can fix your value.
For example, if I want to know the total sales in a workbook regardless of what row/column the value is on, I could use a FIXED LOD expression:
{FIXED : SUM([Sales]}
If you put the above on Label and a Month dimension on rows, it will ignore the segmentation of months and display the total sum of sales for the entire workbook.
You can choose to fix on a different level of detail to achieve a different result:
{FIXED [Month] : SUM([Sales]}
If you put the above on Label and a month and date dimension on rows it will display the total sum of sales for each month, and ignore the date. And so on...
They're somewhat tricky to get used to, but they come up a lot in more complex workbooks.
I would put it this way, the DAX language is at least as powerful as Tableau expressions (involving LOD or otherwise). That is, if you can do it with Tableau LOD, then there's also a way to write something equivalent with DAX.

Calculate % of two columns Power BI

I want to calculate % of two columns which are already in %.
I want to calculate formula like
Target achieved= ACTUAL/TARGET
But here is ACTUAL is already a measure/calculated metrics so I'm not able to divide these two columns.
Any help would be appreciated..
Make sure both target and actual are actually numbers and not strings. You can do it in transform data (aka Power Query) part, before data is loaded into the report.
After that you should be able to create the measure you want, e.g. something like that:
UPDATE : What happens if Actual is not a column, but a measure?
If Actual measure is based on the columns in the same table as target you shouldn't have a problem. You cannot combine measure and column in the same formula. Measure is an aggregated field and needs to be grouped by another field (if you are familiar with SQL,think of SUM and GROUP BY). Coming back to your problem, you need to create measure out of "Target" column as well (notice I have in the formula SUM('Table'[Plan]) which makes it a measure). Than you can use both of them in the formula, but of course you need to "group" them by something(e.g. date) otherwise it will just show you a total.

Show measure only when another filter is active

I'm very new to Power BI, so please be kind as I'm trying my best to learn.
I'm creating a measure that shows the average of all historic data from a given instrument (I can select the instrument from a chart in the dashboard).
The thing is: the average has meaning only when I select one instrument. When two or more instruments are selected, I don't want to show the average.
The average is calculated by data on a table that has the columns: Instrument_ID, date, time, elevation (that's the column where I calculate the average).
Can someone give me directions of what to do please? Thanks for your time!
This is possible, with two methods,
Set the slicer to only allow one value selection
or
Check if the slicer only has one value selected using HASONEVALUE
Your DAX will have to be wrapped with an IF statement, and assuming that the slicer is using the 'Instrument_ID'
Your measure = IF(HASONEVALUE(tablename'Instrument_ID'), CALCULATE(AVERAGE(table[elevation])), BLANK())
You are not doing a compare in your IF statement, as HASONEVALUE will return a True/False. If the selected item only has one value, then it will return your measure, else in this case blank.

Can a measure be created in Power BI that references two tables that share no relationship?

I'm trying to create a matrix table in Power BI to display the monthly rent projections for a number of properties. I thought I could simply create a measure that summed the rent from one table and then displayed it by month based on start and end date conditions, but it's been a while since I created any measures and I had forgotten that there needs to be a relationship between columns, among other things.
Data Model
A site can have more than one lease associated with it and a lease can have both car-parks and floors associated with it, of which there can be multiple.
In addition to the tables in the linked image, once I had sorted out what I thought would be the easy step I was going to add another table which includes the estimated percentage rent increase and the period in which the increase will occur.
I started out by trying to create a measure along the lines of the following:
Matrix Test =
IF (
HASONEVALUE ( Period[Month] ),
IF (
Period[Month] >= Leases[Custom Start Date],
SUM ( Floor_Rent[Annual Rent] ) / 12,
0
),
0
)
This would need to be expanded upon because the end date of a lease would also need to be taken into consideration.
As well as forgetting about the relationship requirements, I've forgotten how to deal with the issue of narrowing down to a single value within a column.
The result is supposed to be something that looks like this:
The blanks indicate a lease that starts in the future or ends within the time-frame displayed.
When I try linking the Leases table and the Period table on Leases[Start month for current term] and Period[Month] all I can get to is a table that shows the rent amount in the month the lease starts.
Is what I'm trying to achieve possible? If so, how do I accomplish the desired result?
Link to .pbix file
Solution
The direct answer to the title question is probably 'no', but while trying to figure out how I could use Pratik Bhavsar's LOOKUPVALUE suggestion I had a thought and performed a clumsy google search - power bi create table for each value in column - and found this post. By meddling with some of the DAX in said post I was able to come up with the following:
Test Table =
GENERATE(
SELECTCOLUMNS(
VALUES(Leases[Lease ID]),"Lease ID",[Lease ID]
),
SELECTCOLUMNS(
VALUES(Period[Month]),"Month",[Month]
)
)
The result is a table with each Lease ID mapped against each Month. I can't claim to understand exactly how the functions work, and it's not the outcome I thought I needed, but it allows me to achieve exactly what I set out to do.
I've accepted Pratik Bhavsar's answer because it effectively accomplishes the same thing as the work around I implemented. Pratik's solution might be better than what I eventually landed on, but I need to have a closer look at how the two compare.
The following DAX will give you a table with all buildings mapped against all rows in the period table, eliminating the requirement of a relationship.
SiteToPeriod =
CROSSJOIN(
SELECTCOLUMNS(Sites1, "Building name/label", Sites1[Building name/label]),
Period
)