Power BI: Customize X-axis labels from related table - powerbi

I have a column chart which plots data from Table A. Table A has release names and counts of defects in each release. Here is how it looks
I have another Table B which has the release dates. Schema of that table is:
Release_Name Release_Date Full_Release_Name
Full_Release_Name actually does not exist. I can create it as a calculated column which concatenates Release_Name and Release_Date.
In the column chart I want the X-axis labels to appear as e.g. IR 18.4 19/12/2017.
How can I do it, without adding a redundant concatenated column in Table A? I want to avoid this as the number of rows in Table A is going to be very large.

I could resolve the issue as below.
Create a relation between the 2 tables
Add the Release_Date field from Table B as 2nd entry on Axis
Drilldown to level where it shows concatenated Release name and date.
If you spot a problem with this approach, let me know.

Related

Measure to compare other table values

I have two tables A&B and I created two measures to find sales of both tables 1&2. When I use the matrix visual to see the values of both tables by using measures, Its showing correct values as per date hierarchy.
But, when I use the 2nd measure of table-b in table-a matrix visual its showing the subtotal values but not as per hierarchy.
I have a requirement to show the measure of table-B in visual 1 which contains table-a regions and date along with measure1 to compare the measure 1&2 in single visual as per hierarchy.
For Visual 1(matrix) - used columns: Region column from table A, date column from date table, measure1
For Visual 2(matrix) - used columns: Region column from table B, date column from date table,measure2
Table A, Table B,Date table : by using date as common column b/w date and table a& b form the 1 to many relationship.
Requirement: formula of measure 2: sum(sales), Its splitting the values as per hierarchy when I use it 2nd visual. I want to see the same in 1st visual, it contains same date column & region for table-A
Can anyone help me to how to solve this?
when I use the 2nd measure of table-b in table-a matrix visual <- This means that you don't have a dimension table that contains information for both a and b. In order to be able to split it, it needs to have the same 'reference', so it knows what date is used for calculating.

Reference variable tables using dynamic table names - Power BI, DAX

I have a measure whereby I calculate some data based on a slicer value. The slicer determines which table I get my data from e.g. SUM(TableA[sales]) or SUM(TableB[sales]). (Each of my tables is of the same structure).
I'd like to be able to set up a variable to dynamically change (with my slicer) which table I'm referring to.
Right now I have:
// Set __table to a stored string representation of the name of the database
// This seems to work
VAR __table = SELECTEDVALUE( AllTables[TableNames] )
// Evaluate the sales column of my variable table
// This doesn't work due to 'Cannot find name sales'
CALCULATE(SUM(__table[sales]))
I guess what I'm after is a way to have the slicer change the referenced table in my measures (with all of the columns being the same for each table).
I'm new to Power BI and I've been struggling with this for several days now. I'd really appreciate any help with either the method I'm attempting or any alternatives.
If you have small amount of data in each table, you can merge them all together as they are in same structure. Just add an additional column with reference of the Table name. Now you can create your Slicer using the new column and it will hold all table names in the list. Now, if you change table name in the slicer, your visuals will show results based on data from that respected table.

Power BI - Unpivot a few columns in a table without interfere the remains columns

So I have this table:
Original Table
I would like to transform the Defect columns into only one without affecting the total of the Inspected column. I've tried the Unpivot the selected columns and brought me this result
Unpivot selected columns
The total of inspected changed from 13 to 52. To solve that problem I've tried to duplicate the table and unpivot only the defects and remaining the inspected in the other table, however I need to make calculations between those tables and both are already related to a third table. Someone has any idea how can I solve this?
Thanks in advance
Add column by example after selecting Attributes, ie Attribute Index.
Calculate count nulls, errors and percentages against the Attribute column total
Calculated Value = SUMX(VALUES(Attribute Index),CALCULATE(MAX(Value)))

How to create table based on minimum date from other table in DAX?

I want to create a second table from the first table using filters with dates and other variables as follows. How can I create this?
Following is the expected table and original table,
Go to Edit Queries. Lets say our base table is named RawData. Add a blank query and use this expression to copy your RawData table:
=RawData
The new table will be RawDataGrouped. Now select the new table and go to Home > Group By and use the following settings:
The result will be the following table. Note that I didnt use the exactly values you used to keep this sample at a miminum effort:
You also can now create a relationship between this two tables (by the Index column) to use cross filtering between them.
You could show the grouped data and use the relationship to display the RawDate in a subreport (or custom tooltip) for example.
I assume you are looking for a calculated table. Below is the workaround for the same,
In Query Editor you can create a duplicate table of the existing (Original) table and select the Date Filter -> Is Earliest option by clicking right corner of the Date column in new duplicate table. Now your table should contain only the rows which are having minimum date for the column.
Note: This table is dynamic and will give subsequent results based on data changes in the original table, but you to have refresh both the table.
Original Table:
Desired Table:
When I have added new column into it, post to refreshing dataset I have got below result (This implies, it is doing recalculation based on each data change in the original source)
New data entry:
Output:

How can I have dynamic axis which is responsive on slicer value, without using bridge table, use just DAX

Hi everyone, I have a chart which I need that the x value (Axis) changes by changing the slicer value (this slicer is the yellow one that has all the Dims (x values)) and it comes from DimList table. For example, at the moment the chart is totalfreight by custid, but I need if I check the empid from the yellow slicer the chart value changed to totalfreight by empid. This happens for all of the slicer values.
But I don't like bridge table or any method that has a bad effect on performance because the FactTable has a billion rows and I modeled it in SSAS, tabular model and has a live connection. Thanks in advance.
I assume you're referring to the approach that uses a bridge table described in this article. I agree that you may face some performance problems given the amount of data in your model.
First of all, you should try to see if there's some other Power BI frontend functionality that you can use directly in the report, without changing your data model. Perhaps you can use Power BI bookmarks, links or maybe a custom visual?
If not, there's another approach you can use in the data model, that does not rely on bridge tables. Disclaimer: I haven't tested this - there could be other performance issues involved.
Construct a new dimension table with all the members from your individual dimensions. Ie. create a union of all EmpIDs, CustIDs, etc. Make sure you indicate the type of ID in a separate column. The table should look like this:
DimensionId MemberId
categoryid 1
categoryid 2
categoryid 3
custid 1
custid 2
custid 3
...
Let's name this table 'All Dimensions'. The table should not have any relationships to other tables (this is similar to the Parameter Table pattern.
Change your measures to apply a virtual relationship whenever something is selected on the 'All Dimensions' table, to properly filter the fact table:
SUM('factSale'[Freight])
would become:
SWITCH(
SELECTEDVALUE('All Dimensions'[DimensionId]),
"categoryid", CALCULATE(SUM('factSale'[Freight]),
KEEPFILTERS(TREATAS(VALUES('All Dimensions'[MemberId]), 'factSale'[CategoryId])),
"custid", CALCULATE(SUM('factSale'[Freight]),
KEEPFILTERS(TREATAS(VALUES('All Dimensions'[MemberId]), 'factSale'[CustId])),
"empid", CALCULATE(SUM('factSale'[Freight]),
KEEPFILTERS(TREATAS(VALUES('All Dimensions'[MemberId]), 'factSale'[EmpId])),
// ... etc. for all dimensions ...
, // Fallback, when nothing is selected on 'All Dimensions'
IF(NOT ISFILTERED('All Dimensions'[MemberId]),
SUM('factSale'[Freight])
)
)
Put the [DimensionId] column into a slicer and use the [MemberId] column as the axis on your bar chart. Note that the chart will not show anything unless exactly one item has been filtered on the [DimensionId] slicer.
Explanation: The SWITCH statement determines if any selection has been made on the [DimensionId] column of the 'All Dimensions' table. In that case, a filter is applied to the fact table, depending on which dimension has been selected, using the TREATAS function. We're using KEEPFILTERS to make sure that any existing filters made directly on the individual dimensions are kept as-is.
In case no selection has been made on the [DimensionId] column, we want to fall back to the standard measure SUM('factSale'[Freight]) but since we don't want to repeat this measure for all items on the [MemberId] column, we use IF(NOT ISFILTERED( ... to make sure that we return only a blank value, if [MemberId] is currently used on the chart axis.