cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ranaanees Regular Visitor
Regular Visitor

How to add related table column with if condition?

Hii,

I have a fSales and SalesDim tables.

fSales table have a DefaultDimension Id from SalesDim table.

In fSales table I have to add all DISPLAYVALUES as new columns based on NAME column from SalesDim table.

 

Example

 

in fSales need to add new columns  like

Area = If(SalesDim[NAME] = "Area",  SalesDim[DISPLAYVALUE])

Customer = If(SalesDim[NAME] = "Customer",  SalesDim[DISPLAYVALUE])

 

What will be the DAX syntax for fSales table in Power BI?

 

SalesDim table

dimtable.png 

Thanks

2 ACCEPTED SOLUTIONS

Accepted Solutions
ranaanees Regular Visitor
Regular Visitor

Re: How to add related table column with if condition?

Hii @v-danhe-msft

 

Thank you for your detailed reply.

 

1. There is One to many relation from SalesDim to fSales.

2. In fSales table I want to add SalesDim rows as columns.

3. Means in fSales table one row will show all related columns in SalesDim.

My requirement 

fSales.png

What do you think the relation between two tables correct?

 

Thanks

View solution in original post

Highlighted
ranaanees Regular Visitor
Regular Visitor

Re: How to add related table column with if condition?

These are two of my tables. How to make relation ships between both? 

 

Sales_DefaultDimView.png

View solution in original post

4 REPLIES 4
ranaanees Regular Visitor
Regular Visitor

Re: How to add related table column with if condition?

Help Please...

v-danhe-msft Super Contributor
Super Contributor

Re: How to add related table column with if condition?

Hi @ranaanees,

From your description, I guess you want to add the related ‘SalesDim‘[DISPLAYVALUES] column based on the ‘fSales’[DefaultDimension], if so, you could refer to below steps:

1.Add index column for the two tables respectively and apply it.

1.PNG

2.Create a new calculated column and now you can see the result.

Column = RELATED(SalesDim[Displayvalue])

3.PNG

You can also download the PBIX file to have a view.

https://www.dropbox.com/s/lnzkvcllk9um21f/How%20to%20add%20related%20table%20column%20with%20if%20co...

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ranaanees Regular Visitor
Regular Visitor

Re: How to add related table column with if condition?

Hii @v-danhe-msft

 

Thank you for your detailed reply.

 

1. There is One to many relation from SalesDim to fSales.

2. In fSales table I want to add SalesDim rows as columns.

3. Means in fSales table one row will show all related columns in SalesDim.

My requirement 

fSales.png

What do you think the relation between two tables correct?

 

Thanks

View solution in original post

Highlighted
ranaanees Regular Visitor
Regular Visitor

Re: How to add related table column with if condition?

These are two of my tables. How to make relation ships between both? 

 

Sales_DefaultDimView.png

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 218 members 2,289 guests
Please welcome our newest community members: