I have a problem with Power Bi.
In fact, I have 2 tables A (before) and B (after) which represent changes in activities, as well as its schedules for customers.
The same customer has several different business lines. Sometimes there are changes at the activity, but sometimes the activity is not changed at all, but location change in table B (after). They are connected to each other with the unique key
I would like to obtain the final table C, which will only have one line per customer, and which would allow me to see:
the difference in minutes from the start of the day (after - before)
the difference in minutes for the end of the day (after - before)
the total number of "work" in the "activities' type" column
total number of jobs modified
if the working hour has been modified
if the job number has been modified
Thank you
One possibility is:
Create Table C containing only column Key.
Create a relationship between A and C, B and C using column Key.
Create a new calculated column in Table C, taking A and B data.
IMPORTANT: in step 3) the calculation has to be done using the function CALCULATE in order to explicit the relation A,C and B,C
Result = CALCULATE(SUM(data from Table A),Table C[Key]=Table A[Key])
+ CALCULATE(SUM(data from Table B),Table C[Key]=Table B[Key])
Related
i hope someone can help me.
I have several files (10 at least) connected by YEAR (just as number, not date) and CASE, and for each file I have a cash flow (i upload pbix sample file with 3 files only to simplify things)
So i Have Flow A, Flow B, Flow C, by year (not as date type) and not always Flow A has a value in a year corresponding for Flow B or C as can be seen on visuals
I created a measure for Total Flow and that works perfect.
But now, i need to calculate net present value for TOTAL FLOW and i was thinking in creating a Calculated Column with sum of Flow A, B and C, and then use XNPV...... but i get a total result for all rows in my column, I have my tables with relation to table with year and case, so i don't understand why can i just sum up 3 columns, by rows. It looks simple on excel, but not efficient if i chose that way
Creating a measure for XNPV it's not working, i get constan error (4 arguments)
I don't want to create a new excel file for getting NPV because it's to slow and i already did it and my dataset it's constantly changing (adding more CASES)
Any orientation ? How can i get in Power Bi, Net present value for Total FLow?
Thank you in advance
PBIX Sample
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
)
I need a calculated column based on conditions in two columns (Business Unit Number in both tables and L1/Account Categories in 1st table and the second table) which sum and then repeat for several rows before the conditions change and a new sum is repeated for several rows and so on. The L1/Account Categories columns have different names because it's the raw data.
For example, any time ASSETS and 111 appear in the same row, I would want to use those as conditions and with the sum of all of the other matching rows in a new column and the sum would repeat each time both conditions appeared in the same row. Any time P/L and 111 appear in the same row, that would be a sum of all other P/L and 111 appearances in the dataset (about 1000 rows overall)... and so on.
I've tried formulas with DAX using FILTER, SUMX, nested IF statements and also tried the Power Query language among other attempts. Maybe I have to create one or more than one new table? If you need to take a look at a few of my attempts, just let me know.
The top image is how I imagine the output will look in the power query editor and the bottom image is a sample of the source data.
This last pic is from Tableau - I need to make a table in Power BI which essentially a duplicate of this image. The last 2 columns are pulling from different tables.
This should be very simple to achieve with relationships and measures - no need for calculated columns or power query merges. You need to build a relationship between these two tables. In fact, I would introduce a third table in your model for Business unit.
The limitation of Power BI model relationships is that they can only be based on a single column. So to build a relationship between these two tables you would have to add a calculated column in both of them that would contain both a BU and the financial statement line, for instance: JoinCol = CONCATENATE([Business_Unit_Number], [L1]). Then you could create a relationship and do what you want.
The better (one that I would recommend) approach would be to separate Business Unit into a separate table and have relationships built like this:
Then all you have to do in your visual is drag Business unit name from the BU table, L1 from the FS Lines table and a measure to sum the amounts Amount = SUM('Financial Data'[Rolled Up Detail]).
Here is a working sample: https://1drv.ms/u/s!AmqvMyRqhrBpgtUT5HKnZP1U3Gzc9w?e=en91dV
Hi I have two tables one has a large number of orders with a column for date. The second table has one column labeled month and another with hours making for 12 rows in total. I want to make a new column by dividing the count of orders per month by the hours of that month from the second table.
In excel i'd simply countif orders that are in January from the first table and divide by the hours in January from the second.
I'm having trouble figuring out the best way to make this new table with calculated values from the existing tables.
Thanks for your time.
Below is a picture of table 2. The first table is a standard dataframe with thousands of rows.
Two options.
You can use the "Append Query" and create a new table that is combining all of your data.
You can also use CALCULATE(SUM(table[field]), filter(table, table[field] = table[monthfield]) /SUM(table[field])
If you could give an example of what you have, I could definitely show you how to accomplish this.
Here is a link to the solution file. One by merging data, and one by using CALCULATE(SUM(),FILTER())
https://drive.google.com/file/d/1yxpv62Dnv8LSNW_mxibPfL0aCMrepoCU/view?usp=sharing
I'm attempting to create a shared date dimensions between two fact tables in Power BI, based off of a relational data source.
Currently, if I include an unrelated dimension in the report, I get numbers duplicated across multiple rows, where they don't really apply.
I'm wondering if there is any way to tell Power BI that certain dimensions cannot be used with certain fact tables, similar to using IgnoreUnrelatedDimensions in SSAS.
Currently the only solution I can find is to create a separate date dimension, so that the two fact tables have no relationship that could be used to join them, however this would mean forfeiting the ability to do any time based comparisons.
Create a combined view of the fact tables with only compatible columns to be used for time based comparison:
In Query Editor, create new queries for your fact tables by
referencing i.e. right click original query and select "Reference".
Then in those "copies" cut out the incompatible dimensions.
Rename columns to align terminology (e.g. Sales Date ==> Transaction Date, Payment Date ==> Transaction Date).
Use "Merge Queries" function to combine the copies using Full Outer Join.
Join this merged view to your date dimension