multiply columns in two different tables in Power BI - powerbi

I have just started using Power BI and I am having trouble multiplying two columns that are in different tables. I have created a relationship between the tables and have tried different formulas that have not worked.
I have a table that is called h_reserva and a table called cambio divisas. I want to add a column on the table h_reserva that is the product of the column 'importe' in h_reserva and 'GBPEUR' in cambio divisas.
The last thing I tried was Medida = RELATED(h_reserva[importe])*RELATED('cambio divisas'[GBPEUR])
Does anybody know how I can modify the formula so that it works? Any help is appreciated :)
Thank you in advance

A calculated column in h_riserva should work
Medida = h_reserva[importe] * RELATED('cambio divisas'[GBPEUR])
if the relationship has been set up properly.

Related

Can we compare two tables in a Switch Case in DAX Power BI?

Is it possible to include columns from 2 different tables in DAX Switch Function ?
Both of my tables are linked by Many to Many Relationship.
I am trying to create a calculated column in Table A where I want to compare Columns from Table B, but I can't add the Table B column in the DAX Switch formula.
Any suggestions would be appreciated.
Thanks & Regards,
Pratik
Sample
Table B
Table A & Expected Result
In my opinion, it doesn't matter whether this table has many relationship, the only thing matter is that you are calculated based on your original table instead of calculate on a new measure, then result is unpredictable:
By create new table from the original table, and add column for the comment, I can provide result as your expectation, hope it solve your problem and accept the answer :)
Create new table from original table (Sheet1 is my old table) and select on ID column
Table = SELECTCOLUMNS(Sheet1,"ID",Sheet1[ID])
Create new column for comment
Column = SWITCH(LOOKUPVALUE('Sheet1'[Value],Sheet1[ID],'Table'[ID]), 0,"Matched with A","Matched with B")
The outcome for the new table:
Instead of trying to use two columns from two different tables for comparison in DAX, you can use the 'RELATED` DAX function to import a column from Table A to Table B or vice-versa. Then you can use this column for comparison in DAX.
Just set the appropriate relationship between Table A and Table B and create a new column with the RELATED DAX function to import the table that you want to use in the SWITCH function.

how to move columns in one table to other table in power bi?

I want to move(denormalize)two tables into another tabe,how can I do it?
have two tables like:- 'sales by category','product by category',
I want to move these two tables into another table which is 'products'.
i tried Related function with calucated column and it won't work bcoz those tables sharing one-one relationship
plz solve my issue who are familiar with data modelling and dax in power bi
The best way is to use the merge function in power query, follow the tutorial on the below link it'll explain it better, this will allow you to join the tables you need into query, in turn creating a table in Power BI
https://learn.microsoft.com/en-us/power-bi/desktop-shape-and-combine-data#combine-queries

Powerbi calculate difference on two column values on Table

I have a Table visual on my dashboard:
And i would like to calculate the difference between amount and amount2, and add an extra column to the table visual(use a measure?), it would look like this:
How to do this?
I hope you guys can help me out :)
If you drag-and-dropped those amount columns onto your table, then Power BI automatically creates an implicit measures in the background that likely looks like SUM(Table1[amount]) and SUM(Table1[amount2]). To calculate the difference, create a measure to subtract the second from the first:
Difference = SUM(Table1[amount]) - SUM(Table1[amount2])
There are other ways to write this as well. This might work too.
Difference = SUMX(Table1, Table1[amount] - Table1[amount2])
First, we have to create a relationship between tables
Then we have to create the many-one(*<->1) relation between those tables
We have to create a new column difference on today table
CDC Change = VALUE(RELATED(yesterdayDataBucketCount[KPI_Value])- todayDataBucketCount[KPI_Value])

power bi: combine multiple tables into one

In Power BI, I am creating a report with some finance data of a company. I have 3 different tables. The table structure of all three tables are as follows:
I want to change these tables into this structure:
Is it possible to achieve this kind of structure? If yes and please suggest some method to do this?
To do it simply you can import 3 times your table using the query editor, and then in one table keep only columns for Planned, in the second table keep columns for Actual, and so on...
Hope that helps!

power bi: calculated columns dont appear in merge/append query

why in power bi calculated columns do not appear in merging or appending two different tables? Is there any way to enable this thing?
I am facing difficulties while merging two tables in which one of the table contains calculated columns.
Calculated columns doesn't appear in query editor. Try adding column in query editor itself if possible.