Measure to compare other table values - powerbi

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.

Related

Two slicers and each slicer affect one column each in a table using powerbi

I have a project that involves building a dashboard using power bi. It is composed of a table with three columns: company name, total revenue, and revenue change %. These are the following requirements.
Create two slicers.
The first slicer must only slice the revenue column.
The second slicer must slice the revenue change % column.
When you slice the first column, the other column must remain static. This is also the same when you do it with the second slicer.
I have tried a lot of options like using the parameter field but I cannot find any solution for the requirements. I have known that a slicer affects the whole table, and not just one.
Do you have any suggestions as to what I will do to meet the requirement of the project?

Add customizable date range comparisons to a Power BI Table

I am trying to recreate a Tableau table view in Power BI where I can compare two customizable date ranges and show the percent differences across metrics as a calculated row.
Reference Screenshot from Tableau
In practice, my table will have 3 rows: 1 row for each time period selected and a row for the percent difference. The percent difference row is a nice to have, not a need. All my table metrics are coming from the same source.
I also need to set up two different date slicers that each row of my table will reference. I've played around a little with setting up a separate date table for the comparison period to be selected from, following this thread: Comparing Data Across Date Ranges
The challenge now is showing two separate periods in the same table.
Appreciate any guidance!

Power BI Divide two measure from different tables and show in a graph with time

I have two tables, Table one has daily data, Table two has weekly data. I've created a start of week column in Table 1 to get weekly data. Data is as shown below :
I want to create a table where I can divide these two measures. Both measures are counts in a week. I want to present this in a line/bar chart with time at the x-axis. Right now when I use the Date of Table 1, My measure 2 takes the overall count as the date of table 2 is not present and vice versa. I was thinking of creating a new Calendar table but I'm unable to get these measure values in that table.
I tried creating a custom calendar table but I'm not getting the desired result. I'm getting correct values from table 2 but no values from table 1. I feel the problem is because table 1 has duplicate date values.
Table 1 actual data before consolidation:Measure is the count of case numbers
I think you need a slight paradigm shift in your thinking, potentially.
Rather than looking for a way to create a third table from two other tables, what you should do is create a relationship between the two tables to make a rational description of how you want these tables to work, and then write the DAX on top of it.
So, in your case, you describe one table having daily data, and the other having weekly. The intermediary calendar table would be a daily calendar, where each day (row) knows the end of week date.
You would then create a relationship from your daily table to the calendar table based on day, and create a second relationship to your weekly table based on end of week date. (assuming bi-directional filtering)
You could then create a measure:
myRatio = DIVIDE(SUM(DailyTable[value]), SUM(weeklyTable[value])
In your chart, you can then show the daily value as a fraction of the weekly value by using the 'Day' field from the calendar table, or you could show the ratio of the complete week from the daily table to the weekly total in the weekly table by using the end of week date in the chart.
If what you truly need is a 3rd table, then you could use the SUMMARIZE() function on this 3 table set to do the summarization into a 3rd table using the same principle.
myNewTable =
SUMMARIZE(calendarTable
,calendarTable[End of Week Date]
,"My Ratio" //the name of the field you want to create
,[My Ratio] //the formula to describe what goes in the field
)

Selected filters by default - Power BI

Imagine that I have a column with the following values: [A1,A2,A3,A4,T1,T2,T3]
Now, I have a slicer with the mentioned column, but I need that the the "Ts" (T1,T2 and T3) are always selected / filtered and when I choose a specific "A" (A1) for example, dosn't filter the "T".
For example:
If I select with the slicer "A1" the filter in the page should include: [A1,T1,T2,T3]
If I select "A2": [A2,T1,T2,T3]
So If I select an "A" it have to select the specific "A" and all the "Ts".
How can I do that? With filters? relationships?
Thanks
Short answer: we need a parameter table.
This because we might be able to write a measure that internally sets the filter according to our specification, but the Power BI visual would intercept the slicer setting first and would show only the selected rows or columns (for a matrix visual).
Assuming we have the table
this measure ignores any selection from the slicer, computing the total of the whole column, but the matrix visual will only show the row selected with the slicer
TotalV = SUMX(ALL(T), T[V] )
To solve this we can build a parameter table with the combination we want when selecting the F parameter, for instance like the following Parameter table
The column P is to be used in the slicer, while the column F is used to set up a bi-directional relationship with the original T table
Now we create the relationship
We create the measure
SumV = SUM(T[V])
setting the slicer over 'P' and a matrix with 'T[F]' on the rows and the measure '[SumV]' as value we obtain the desired behavior
Additional considerations:
the Parameter table can be generated manually or using a DAX
calculated table
to build a better model we might create a dimension for F
the bidirectional relationship in this configuration doesn't make
the model ambiguous, but we must pay attention when adding tables
and relationships to the model

Power BI: Customize X-axis labels from related table

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.