Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Example Table:
| Origin | Destination | Scenario 1 | Scenario 2 | Scenario 3 |
| A | B | 10 | 11 | 12 |
| B | C | 6 | 3 | 2 |
Thank you in advance for helping me solve this problem!
I have 2 parameters that define which 2 fields I want to use in a calculated new column. For example: A user selects Scenario 2 and Scenario 3 as Parameter 1 and Parameter 2, respectively. In a new calculated column I would see the results of Scenario 2 value - Scenario 3 value, as shown in the Calc Col below. What does the syntax look like to create this calculated column based on the user selected parameters?
| Origin | Destination | Scenario 1 | Scenario 2 | Scenario 3 | Calc Col |
| A | B | 10 | 11 | 12 | -1 |
| B | C | 6 | 3 | 2 | 1 |
Solved! Go to Solution.
u could, peraphs use this sheme:
a function like this:
let
newTab = (Col1,Col2)=>Table.AddColumn(Table, "newColumnName", each Record.Field(_, Col1)-Record.Field(_, Col2))
in
newTab
which when invoked using the names of two columns of you table:
gives:
I think i figured it out. I modified your Function to be a simple addcolumn step:
Table.AddColumn(PreviousStep, "Delta", each Record.Field(_, #"Scenario 1")-Record.Field(_, #"Scenario 2"))
Where Scenario 1 and Scenario 2 are the query parameter names. Seems to work!
u could, peraphs use this sheme:
a function like this:
let
newTab = (Col1,Col2)=>Table.AddColumn(Table, "newColumnName", each Record.Field(_, Col1)-Record.Field(_, Col2))
in
newTab
which when invoked using the names of two columns of you table:
gives:
I think i figured it out. I modified your Function to be a simple addcolumn step:
Table.AddColumn(PreviousStep, "Delta", each Record.Field(_, #"Scenario 1")-Record.Field(_, #"Scenario 2"))
Where Scenario 1 and Scenario 2 are the query parameter names. Seems to work!
Close! The only issue I am running into is the parameters are query parameters so I am not sure how to assign the query parameters to your function parameters? If that makes sense?
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |