Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PBE
Helper II
Helper II

Create Variables from a table

Hi, I would like to create variables from a table which relate to the row number and a specific column.

 

There are two columns WL and ST. Each variable will be numbered in relation to Row No. As shown below, for example:-

For Row 1 the two variables will be WL1 and ST1. Where WL1 = 21 and ST1 = 1680

For Row 2 the two variables will be WL2 and ST2. Where WL2 = 156 and ST2 = 1680

and so on up to a maximum of 30 rows.

PBE_1-1692200974888.png

 

I will then use the variables in different formulas such as

Formula 1 = WL1 + ST1

Formula 2 = Formula 1 + WL1 - ST1

Is it possible to extract a figure in a column and relate to row no. such as WL1 = 21 or ST1 = 1680?

 

I hope this makes sense. Any question let me know.

Thank you for any help in advance.

PBE

 

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @PBE 

 

You can try the following methods.

New table:

New table = ADDCOLUMNS('Table',"WL Variable","WL"&[Row No.],"ST Variable","ST"&[Row No.])

vzhangti_0-1692604344179.png

Column:

Formula 1 = IF([WL Variable]="WL1"&&[ST Variable]="ST1",[ST]+[WL])

vzhangti_1-1692604388730.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @PBE 

 

You can try the following methods.

New table:

New table = ADDCOLUMNS('Table',"WL Variable","WL"&[Row No.],"ST Variable","ST"&[Row No.])

vzhangti_0-1692604344179.png

Column:

Formula 1 = IF([WL Variable]="WL1"&&[ST Variable]="ST1",[ST]+[WL])

vzhangti_1-1692604388730.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Thank you that worked

Hi @v-zhangti 

Thanks for this, it looks good. I'll try it out and let you know how I get on.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.