Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
how can I ensure, the function execution result returns same type as mentioned in the function?
let
test_type = () as text=> "Hello",
tbl = #table(type table [Name = text, Score = number], {{"Betty", 90.3}, {"Carl", 89.5}}),
#"Added Custom" = Table.AddColumn(tbl, "Custom", each test_type())
/*want to avoid doing below and the type needs to cascade from the function*/
/*Table.AddColumn(tbl, "Custom", each test_type(), type text)*/
in
#"Added Custom"
getting this
desire this
without requiring to do this
Table.AddColumn(tbl, "Custom", each test_type(), type text)
Solved! Go to Solution.
How about this?
= Table.AddColumn(tbl, "Custom", each test_type(), Value.Type(test_type()))
How about this?
= Table.AddColumn(tbl, "Custom", each test_type(), Value.Type(test_type()))
Smashing
Why not first define the records, then build your #table by referring to the records and the the function, and assign the text type in the #table function itself?
--Nate
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 11 | |
| 10 | |
| 7 | |
| 7 | |
| 7 |