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,
I'm pretty new to Power Query and I need help to implement a new column that shows if a specific OppID is open or deleted if the dataload is different from the refresh time.
Right now I have implemented this step as you can see below:
However, if the specific "OppID" is Open then the column should return "Open" for all rows that that specific OppID. Like this:
Solved! Go to Solution.
You can use below in Power Query
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hc2xDcAwCATAXaiNBP9JwSyW918jREm6YCQa/gQ/p7gMMdccmMe9QN2eZY3X0TgbPxo/a0dGNLXYeB5/0b+jdmaEqP+z6WfTz13/ugA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [OppId = _t, DataLoad = _t, LastRefresh = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"OppId", Int64.Type}, {"DataLoad", type date}, {"LastRefresh", type date}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"OppId"}, {{"AllRows", each _, type table [OppId=number, DataLoad=date, LastRefresh=date]}}),
Custom1 = Table.AddColumn(#"Grouped Rows","Status",each if(Table.RowCount(Table.SelectRows([AllRows],each [DataLoad] = [LastRefresh])) > 0) then "Open" else "deleted"),
#"Expanded AllRows" = Table.ExpandTableColumn(Custom1, "AllRows", {"DataLoad", "LastRefresh"}, {"DataLoad", "LastRefresh"})
in
#"Expanded AllRows"In DAX, you can add Conditional Column as below
Status =
IF (
COUNTROWS (
FILTER (
'Table3',
Table3[DataLoad] = EARLIER ( Table3[LastRefresh] )
&& Table3[OppId] = EARLIER ( Table3[OppId] )
)
) > 0,
"Open",
"Deleted"
)Thanks
Ankit Jain
Do Mark it as solution if the response resolved your problem. Do Kudo the response if it seems good and helpful.
You can use below in Power Query
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hc2xDcAwCATAXaiNBP9JwSyW918jREm6YCQa/gQ/p7gMMdccmMe9QN2eZY3X0TgbPxo/a0dGNLXYeB5/0b+jdmaEqP+z6WfTz13/ugA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [OppId = _t, DataLoad = _t, LastRefresh = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"OppId", Int64.Type}, {"DataLoad", type date}, {"LastRefresh", type date}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"OppId"}, {{"AllRows", each _, type table [OppId=number, DataLoad=date, LastRefresh=date]}}),
Custom1 = Table.AddColumn(#"Grouped Rows","Status",each if(Table.RowCount(Table.SelectRows([AllRows],each [DataLoad] = [LastRefresh])) > 0) then "Open" else "deleted"),
#"Expanded AllRows" = Table.ExpandTableColumn(Custom1, "AllRows", {"DataLoad", "LastRefresh"}, {"DataLoad", "LastRefresh"})
in
#"Expanded AllRows"In DAX, you can add Conditional Column as below
Status =
IF (
COUNTROWS (
FILTER (
'Table3',
Table3[DataLoad] = EARLIER ( Table3[LastRefresh] )
&& Table3[OppId] = EARLIER ( Table3[OppId] )
)
) > 0,
"Open",
"Deleted"
)Thanks
Ankit Jain
Do Mark it as solution if the response resolved your problem. Do Kudo the response if it seems good and helpful.
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 | |
| 2 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 9 | |
| 8 | |
| 7 | |
| 5 | |
| 5 |