Forum Discussion
How to create a new table base on another table column with condition
- 2 years ago
Hi kentchiu
You can try below DAX Table expression.
New Table = FILTER ( Table, VAR CurCreated = Table[CREATED] VAR LatestCreated = CALCULATE (MAX(Table[CREATED]),ALLEXCEPT (Table,Table[ISSUE_KEY])) RETURN CurCreated = LatestCreated )But in your this case, the best method is use the PowerQuery to create the new table, which only need two step.
Step1. Sort by ISSUE_KEY and CREATED (The CREATED need to sort in descending)
Step2. Perform deduplication on on the table based on ISSUE_KEY
Because the deduplication operation in PowerQuery will only retain the first occurrence of the row.
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
- 2 years ago
Hello kentchiu
You can achieve this by using both DAX and PQ.
Below is the DAX queryVAR _1 = ADDCOLUMNS( SUMMARIZE( Source, Source[ISSUE_KEY], Source[Issue Status Name] ), "@Created",CALCULATE( MAX(Source[CREATED]) ) ) RETURN _1PQ solution
let Source = Source, #"Grouped Rows" = Table.Group(Source, {"ISSUE_KEY", "Issue Status Name"}, {{"Created", each List.Max([CREATED]), type nullable datetime}}) in #"Grouped Rows"Below attached file
Let me know if it helps
Regards,
sanalytics
If it is your solution then please like and accept it as solution
Hello kentchiu
You can achieve this by using both DAX and PQ.
Below is the DAX query
VAR _1 =
ADDCOLUMNS(
SUMMARIZE(
Source,
Source[ISSUE_KEY],
Source[Issue Status Name]
),
"@Created",CALCULATE( MAX(Source[CREATED]) )
)
RETURN
_1
PQ solution
let
Source = Source,
#"Grouped Rows" = Table.Group(Source, {"ISSUE_KEY", "Issue Status Name"}, {{"Created", each List.Max([CREATED]), type nullable datetime}})
in
#"Grouped Rows"
Below attached file
Let me know if it helps
Regards,
sanalytics
If it is your solution then please like and accept it as solution