Forum Discussion

Sarah-Barlow's avatar
Sarah-Barlow
Frequent Visitor
3 years ago
Solved

Create table from another table with conditions

I have data that gets updated monthly, but not all the names in the rows are updated each month so I need to create a new table with three columns (Name, Date, All … so the same name only appears onc...
  • v-yueyunzh-msft's avatar
    3 years ago

    Hi , Sarah-Barlow 

    According to your description, you want to get a table that has the only one [PCN_Name] and the only one max  of [Effective_Snapshot_Date]. And the corresponding [ALL] value.

    Here are the steps you can refer to :
    (1)This is my test data:

    (2)We can click "New Table" and enter this:

    Table 2 = ADDCOLUMNS( SUMMARIZE('Table','Table'[PCN_Name] , "Effective_Snapshot_Date" ,CALCULATE( MAX('Table'[Effective_Snapshot_Date]))) , "ALL" ,  CALCULATE( SUM('Table'[ALL]),TREATAS({[Effective_Snapshot_Date]},'Table'[Effective_Snapshot_Date]),TREATAS({[PCN_Name]},'Table'[PCN_Name])))

    (3)Then we can meet your need , the result is as follows:

     

     

    If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly