cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
CLQ
Helper I
Helper I

Is it possible create a column inside a variable, "emulating" a related?

Hi, good morning (or good afternoon or good evening). I want to know if the following is possible:
I have two tables, I created a column in the 'Order Attributes' table thanks to the relationship between them:

 

 

Store_ID = RELATED('Business - Store'[STORE_NK])

 


Then, I used that column for a calculation in Dax on another column. Something like that:

 

TypeofStore = var StoreId=[Store_ID]
var StoreName=SELECTEDVALUE('Order Attributes'[operator_nk])
var selectdate='Order Attributes'[Order Date]
......
return
.....
(I don't write all the code because I don't think it's necessary)

 

So let's say I don't want to have so many columns inside the table 'Order Attributes' and I want to remove the Store_ID column. For that, I would like to "create" a column in a variable, i.e. I am trying to emulate/copy

 

Store_ID = RELATED('Business - Store'[STORE_NK])​

 

And write something like this:

 

TypeofStore =
var StoreId=ADDCOUMNS('Order Attributes', "Store_ID", RELATED('Business - Store'[STORE_NK])
var StoreName=SELECTEDVALUE('Order Attributes'[operator_nk])
var selectdate='Order Attributes'[Order Date]
......
return

 

It's possible?

Thank you

1 ACCEPTED SOLUTION
HoangHugo
Solution Specialist
Solution Specialist

Yes, it is possible, you will have an extended version of your "Order Atributte".

 

Learn more about that

https://learn.microsoft.com/en-us/dax/addcolumns-function-dax?ranMID=46131&ranEAID=a1LgFw09t88&ranSi...

View solution in original post

2 REPLIES 2
HoangHugo
Solution Specialist
Solution Specialist

Yes, it is possible, you will have an extended version of your "Order Atributte".

 

Learn more about that

https://learn.microsoft.com/en-us/dax/addcolumns-function-dax?ranMID=46131&ranEAID=a1LgFw09t88&ranSi...

The addcolumn should work? I get an error, that's why my question was referring to whether there was any formula where the variable that I tried to create is emulated.

But if it's possible with just an addcolumn, then I must be doing something wrong. thanks

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors