Forum Discussion
Delete rows based on calculated number
- 4 years ago
SoufTC this was super super tricky.
Also, you had mistakes in your tables you copied (look at the first table you pasted), so make sure you test this with accurate data.
Attaching the file:
Delete Rows.pbix
It involved extra neccesary steps in Power Query so make sure you follow them and then I could have written this calculated table:Calc Table = VAR _tbl1 = SELECTCOLUMNS( FILTER( ADDCOLUMNS( FactCalls, "@Removal Index", IF( RELATED(DimStatus[Names]) <> "drop out", 0, RANKX(FILTER(FactCalls,FactCalls[Key] = EARLIER(FactCalls[Key])), FactCalls[Index], ,ASC) - COUNTROWS(FILTER(FactCalls, FactCalls[Status] <> "DO" && FactCalls[Key] = EARLIER(FactCalls[Key]))) ) - RELATED(DimDrops[# drop]) ), [@Removal Index] < 0 ), "List", [List], "Status", [Status], "Date", [Date], "Key", [Key] ) RETURN _tbl1
In case it answered your question, please accept the solution to help other members find it. Appreciate Your Kudos.Showcase Report – Contoso By SpartaBI
Visit SpartaBI website Visit SpartaBI Linkdin Visit SpartaBI Facebook
SpartaBI Logo
SoufTC I'm missing what logic do you want to get from the KEY / # Drop table.
I wrote for now this:
Calc Table =
FILTER(
FactCalls,
RELATED(DimStatus[Names]) <> "drop out"
)
Just add why the DO in your result are still there after the removal and I'll add the logic
In case it answered your question, please accept the solution to help other members find it. Appreciate Your Kudos.
Showcase Report – Contoso By SpartaBI
Visit SpartaBI website Visit SpartaBI Linkdin Visit SpartaBI Facebook
SpartaBI Logo