We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I cannot figure out how to insert the IF xxx[HasError] else xxx then into this statement.
= Table.AddColumn(#"Added Custom9", "Entity", each ( let currentEntryNoKey = [Entry_No_Key] in Table.SelectRows(All_Vendor_Ledger, each [Entry_No_Key] = currentEntryNoKey))
{0}[Vendor_Name])
Basically, if there is an error, I just want it to return blank. If there is no error, then return the {0}[Vendor_Name]
Solved! Go to Solution.
OK, if you just want a value from that table, or null each time there is an error, I would do it like this, so there are no scope issues. Add a new step, name it EntryKeyList, then in the formula bar, type:
= List.Buffer(#"Added Custom9"[Entry_No_Key])
Add a new step, name it NewThing (or whatever), then in the formula bar:
= Table.AddColumn(EntryKey, "Entity" each try Table.SelectRows(All_Vendor_Ledger, each List.Contains([Entry_No_Key], EntryKeyList)){0}[Vendor_Name] otherwise null)
--Nate
Entity = Table.AddColumn(
OK, if you just want a value from that table, or null each time there is an error, I would do it like this, so there are no scope issues. Add a new step, name it EntryKeyList, then in the formula bar, type:
= List.Buffer(#"Added Custom9"[Entry_No_Key])
Add a new step, name it NewThing (or whatever), then in the formula bar:
= Table.AddColumn(EntryKey, "Entity" each try Table.SelectRows(All_Vendor_Ledger, each List.Contains([Entry_No_Key], EntryKeyList)){0}[Vendor_Name] otherwise null)
--Nate
Entity = Table.AddColumn(
I will try this fix and report back. Thanks!
Yes. I guess my problem is where do I put the Try and the Else.. I can't seem to figure that out.
I did try this:
= Table.AddColumn(#"Added Custom9", "Entity", each ( let currentEntryNoKey = [Entry_No_Key] in Table.SelectRows(All_Vendor_Ledger, each [Entry_No_Key] = currentEntryNoKey)),
try {0}[Vendor_Name] otherwise "null")
but now I get a We cannot convert the value "null" to type Type.
I changed it to this...
= Table.AddColumn(#"Added Custom9", "Entity", each ( let currentEntryNoKey = [Entry_No_Key] in Table.SelectRows(All_Vendor_Ledger, each [Entry_No_Key] = currentEntryNoKey)),
try {0}[Vendor_Name] otherwise Null.Type)
it seems to work, but my new problem is that the null results says TABLE, and not null.
Not Null.Type, just null.
When i put null.. the result for all the null say table. But nothing is in that table.
I can't get my head around the TYPE.
The standard method in M is with "try" ... "otherwise". In your case, "try xxx otherwise null" with return xxx if there isn't an error and a null otherwise.
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 10 | |
| 8 | |
| 7 | |
| 7 | |
| 5 |