Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi all,
Here is my data
| Prod Order | Date | Completed | Balance |
| 100002720443 | 10/7/2023 | 262.5 | |
| 100002720443 | 11/7/2023 | 32 | |
| 100002620776 | 12/7/2023 | 31.5 | 11.1 |
My expectation formulation is something as below
if Balance have different Date under same Prod Order, display "warning"
Regards,
Nuha
Solved! Go to Solution.
Hi @Anonymous ,
According to your description, here's my solution.
Add a custom column:
if List.Count(List.Distinct(Table.SelectRows(#"Changed Type",(x)=>x[Prod Order]=[Prod Order])[Date]))>1 then "warning" else null
Get the correct result:
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
According to your description, here's my solution.
Add a custom column:
if List.Count(List.Distinct(Table.SelectRows(#"Changed Type",(x)=>x[Prod Order]=[Prod Order])[Date]))>1 then "warning" else null
Get the correct result:
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Insert following statement where #"Changed Type" should be replaced with your previous step
= Table.Combine(Table.Group(#"Changed Type", {"Prod Order"}, {{"All", each Table.AddColumn(_, "Indicator", (x)=> try if _[Date]{0} <> _[Date]{1} then "Warning" else null otherwise null, type text)}})[All])
Complete code in action
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dczBDcAwCAPAXXiTCJsUhonYf42GvvKpP5alk/cW2AmTtpaLCo0+LAesR3A+p6X0H6KBivNSQcuMW7EJvjdgQqpe", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Prod Order" = _t, Date = _t, Completed = _t, Balance = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Prod Order", Int64.Type}, {"Date", type date}, {"Completed", type number}, {"Balance", type number}}),
#"Grouped Rows" = Table.Combine(Table.Group(#"Changed Type", {"Prod Order"}, {{"All", each Table.AddColumn(_, "Indicator", (x)=> try if _[Date]{0} <> _[Date]{1} then "Warning" else null otherwise null, type text)}})[All])
in
#"Grouped Rows"
Hi @Vijay_A_Verma ,
Done as per your code but it show error
#"Grouped Rows" = Table.Combine(Table.Group(#"Changed Type", {"OrderNumber_AUFNR"}, {{"All", each Table.AddColumn(_, "Indicator", (x)=> try if _[DocumentDate_BLDAT]{0} <> _[DocumentDate_BLDAT]{1} then "Warning" else null otherwise null, type text)}})[All])
Regards,
Nuha
Did you change #"Changed Type" to your previous step in your PQ editor?
If your previous step was also #"Changed Type", then error is due to some other factor. Could you please post that error?
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.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |