Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Dear All,
Could you please help me with converting the following DAX statement to PowerQuery (M)?
= CALCULATE(
Solved! Go to Solution.
Hi @SzEmo ,
Maybe you can try this code:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXLWDwKS/gGufkAKJODrGKLrqhSrE61kBJd29vEPdnUBMoxQFBgDeXn5mNpTwLImMFm4blTjTYG8ytRihHZUw83g0hj6gebHAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}, {"Column2", type text}, {"Column3", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "if", each if List.Contains({"C/R","no"},[Column2])
and List.Contains({"OPEN","CLOSED"},[Column3])
and List.Contains({"1"},[Column4])
and List.Contains({"MAT-E"},[Column5])
then 1 else 0),
#"Grouped Rows" = Table.Group(#"Added Custom", {"if"}, {{"sum", each List.Sum([Column1]), type nullable number}}),
#"1" = #"Grouped Rows"{[#"if"=1]}[sum]
in
#"1"
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @SzEmo ,
Maybe you can try this code:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXLWDwKS/gGufkAKJODrGKLrqhSrE61kBJd29vEPdnUBMoxQFBgDeXn5mNpTwLImMFm4blTjTYG8ytRihHZUw83g0hj6gebHAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}, {"Column2", type text}, {"Column3", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "if", each if List.Contains({"C/R","no"},[Column2])
and List.Contains({"OPEN","CLOSED"},[Column3])
and List.Contains({"1"},[Column4])
and List.Contains({"MAT-E"},[Column5])
then 1 else 0),
#"Grouped Rows" = Table.Group(#"Added Custom", {"if"}, {{"sum", each List.Sum([Column1]), type nullable number}}),
#"1" = #"Grouped Rows"{[#"if"=1]}[sum]
in
#"1"
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Some more detail please. Can you paste in some sample data, in the form of a table?
Can you add some detail around what/why you are trying to do this? Desired outcome?
| Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 9 | |
| 8 | |
| 7 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 14 | |
| 11 | |
| 10 | |
| 9 |