Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello everybody,
I'm stuck on a problem that looks easy but I can't find it.
I'm posting a screenshot with the explanations
Thank you in advance
Best regards
A | B |
2 | 0 |
2 | 2 |
1 | 0 |
0 | 2 |
0 | 0 |
1 | 1 |
2 | 1 |
3 | 0 |
0 | 0 |
1 | 4 |
Solved! Go to Solution.
Hi @Mederic,
You can use @lbendlin's solution and create a record that can be expanded, to illustrate:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlLSUTJQitWBsIzALEO4mAFczAAuBpI1hOuAsIxRdCDUmSjFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"A", Int64.Type}, {"B", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Result", each
[Both = null, Not Both = null, Clean = null] &
(
if [A]>0 and [B]>0 then [Both = 1] else
if [A]=0 and [B]=0 then [Clean = 3] else
[Not Both = 2]
), type [Both = Int64.Type, Not Both = Int64.Type, Clean = Int64.Type]
)
in
#"Added Custom"
once expanded, it will yield this result
wrong order of checks.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlLSUTJQitWBsIzALEO4mAFczAAuBpI1hOuAsIxRdCDUmSjFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"A", Int64.Type}, {"B", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Result", each
if [A]>0 and [B]>0 then 1 else
if [A]=0 and [B]=0 then 3 else
2
)
in
#"Added Custom"
Hello @lbendlin
Thank you for your reply,
Your result is in a single column whereas I wanted it in 3 additional columns.
Best regards
Hi @Mederic,
You can use @lbendlin's solution and create a record that can be expanded, to illustrate:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlLSUTJQitWBsIzALEO4mAFczAAuBpI1hOuAsIxRdCDUmSjFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"A", Int64.Type}, {"B", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Result", each
[Both = null, Not Both = null, Clean = null] &
(
if [A]>0 and [B]>0 then [Both = 1] else
if [A]=0 and [B]=0 then [Clean = 3] else
[Not Both = 2]
), type [Both = Int64.Type, Not Both = Int64.Type, Clean = Int64.Type]
)
in
#"Added Custom"
once expanded, it will yield this result
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
17 | |
10 | |
9 | |
8 | |
8 |
User | Count |
---|---|
15 | |
15 | |
13 | |
12 | |
11 |