Forum Discussion

mathieu_thelot's avatar
mathieu_thelot
Frequent Visitor
10 years ago

Refresh Timsetamp Column apply to each group

In power bi desktop I'm searching to create a new column in a table
In my table "table_1", I have this kind of columns :

Group timestamp value
A 14/01/2016 5
B 14/01/2016 4
C 14/01/2016 6
...
A 16/01/2016 8
B 16/01/2016 7
...
A 20/01/2016 12



So to recape, at the end we have :
Group timestamp value
A 14/01/2016 12
B 16/01/2016 7
C 20/01/2016 6


I want to create a column "refresh":
First, we need to select the last timestamp (= 'last_global')
Then, we need to select for each group the actual last timestamp (='last').
After that, we need to check for each group :
if timestamp ='last' then return in "refresh" the 'last_global'
or
for each group if timestamp not last , then return timestamp

To be more explicit :

 

Group timestamp value | Refresh |
A 14/01/2016 5 | 14/01/2016 |
B 14/01/2016 4 | 14/01/2016 |
C 14/01/2016 6 | 20/01/2016 |
...
A 16/01/2016 8 | 16/01/2016 |
B 16/01/2016 7 | 20/01/2016 |
...
A 20/01/2016 12 | 20/01/2016 |


Refresh is not a measure but a column :

I want to have in my table something like this:

somewhere in my table:
Group timestamp value | Refresh |
..
A 14/01/2016 12 | 20/01/2016 |
..
B 16/01/2016 7 | 20/01/2016 |
..
C 20/01/2016 6 | 20/01/2016 |

If you have any proposition, don't hesitate
I suggest to stay in the same table but if it's easyer with an other method, I'm ok with that ;)

1 Reply

  • v-qiuyu-msft's avatar
    v-qiuyu-msft
    Community Support

    Hi mathieu_thelot,

     

    I'm not very clear about your requirement. How did you get 'last_global' and 'last'? If you want to get the last timestamp within each group value, you can create a table use the expression like below:

     

    Table = SUMMARIZE('table_1','table_1'[Group],"last",LASTDATE('table_1'[timestamp]),"value",SUM('table_1'[value]))

     

     

    If you have any question, please feel free to ask.

     

    Best Regards,
    Qiuyun Yu