Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe'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
Hi Guys,
Can anyone help me with the below query, Like For the First 3 columns any of two columns contains "OK" then I need Will Fit All Product as "Y", If any one of the column contains -(Negative value) then I need to show it as "N".
Will Fit UNL | WIll Fit SUP | WILL Fit DSL | Will Fit All Product |
ok | ok | ok | Y |
ok | ok | -534(Values) | N |
ok | Ok | - (Null/Blank) | Y |
This is I need in Power Query editor
Solved! Go to Solution.
@Anonymous Use this:
let
Source =
Table.FromRows (
Json.Document (
Binary.Decompress (
Binary.FromText ( "i45Wys9W0oETsTrIArqmxiZoQkqxsQA=", BinaryEncoding.Base64 ),
Compression.Deflate
)
),
let
_t = ( ( type nullable text ) meta [ Serialized.Text = true ] )
in
type table [ #"Will Fit UNL" = _t, #"WIll Fit SUP" = _t, #"WILL Fit DSL" = _t ]
),
ChangedType =
Table.TransformColumnTypes (
Source,
{
{ "Will Fit UNL", type text },
{ "WIll Fit SUP", type text },
{ "WILL Fit DSL", type text }
}
),
Custom =
Table.AddColumn (
ChangedType,
"Will Fit All Product",
each
let
ValuesList = Record.ToList ( _ ),
OkCount =
List.Count (
List.Select ( ValuesList, each _ = "ok" )
) >= 2,
HasNegative =
List.Count (
List.Select (
List.Transform (
ValuesList,
each try Number.From ( _ ) otherwise null
),
each _ < 0
)
) > 0,
Result = if OkCount and not HasNegative then "Y" else "N"
in
Result,
type text
)
in
Custom
@Anonymous Use this:
let
Source =
Table.FromRows (
Json.Document (
Binary.Decompress (
Binary.FromText ( "i45Wys9W0oETsTrIArqmxiZoQkqxsQA=", BinaryEncoding.Base64 ),
Compression.Deflate
)
),
let
_t = ( ( type nullable text ) meta [ Serialized.Text = true ] )
in
type table [ #"Will Fit UNL" = _t, #"WIll Fit SUP" = _t, #"WILL Fit DSL" = _t ]
),
ChangedType =
Table.TransformColumnTypes (
Source,
{
{ "Will Fit UNL", type text },
{ "WIll Fit SUP", type text },
{ "WILL Fit DSL", type text }
}
),
Custom =
Table.AddColumn (
ChangedType,
"Will Fit All Product",
each
let
ValuesList = Record.ToList ( _ ),
OkCount =
List.Count (
List.Select ( ValuesList, each _ = "ok" )
) >= 2,
HasNegative =
List.Count (
List.Select (
List.Transform (
ValuesList,
each try Number.From ( _ ) otherwise null
),
each _ < 0
)
) > 0,
Result = if OkCount and not HasNegative then "Y" else "N"
in
Result,
type text
)
in
Custom
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 | |
| 4 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 6 | |
| 6 | |
| 5 |