Forum Discussion

Samuel7265's avatar
Samuel7265
Frequent Visitor
3 years ago

Create a new Table with only the last Case steps from a existing Table

Hi, i´ve been trying to create a new Table using the Summarize(), Addcolums() and Lastnonblank() function.

 

I have a table called "Bearbeitung" which lists all cases with their single steps, this table is sorted in Querry by date (increasing).

I want to create a new Table called "letzte Bearbeitung" which lists for every distinct case "Vorgangs_ID" the the last step based on the last time it was edited.

 

I ran into an error. My code doesnt work right. The LASTNONBLANK() funktion wont give the last result for ID_Nonth_UserID and Status_after_Handling. Don't know why, what am i doing wrong here? Is there maybe a better solution using the GROUPBY() function?

 

 

1 Reply

  • some_bih's avatar
    some_bih
    Icon for Community Champion rankCommunity Champion

    Hi Samuel7265 I do not your language, my bad :), to understand more what is your issue / request.

    Nevertheless, using function LASTNONBLANK(), there is context transition happening so you probably needed to use it.

    Back to your code: 

    Pattern ADDCOLUMNS (SUMMARIZE(  

    in DAX is very common, but in you case based on my experience, you should rewrite it.

    I do not have enought info what is your model and details, still the best practice to use SUMMARIZE is not TO ADD columns into it; in your case you should try to rewrite your code so you have

    ADDCOLUMNS (SUMMARIZE(  f_L_Bearbeitung, <rest of your code>DO NOT PUT new column before closing ), <Here put new columns; "Status..." up to "Editing" and close)

    Basically, you wrap up core code.  Hope this help