Forum Discussion

Hennadii's avatar
Hennadii
Icon for Helper IV rankHelper IV
6 years ago
Solved

Adjust data representation of a table

Hello everyone!   I'd like to create new table (Sorted Journal) using a data from existing tables (Tasks  , Journal) and "slightly" update it. Sorted Journal - should be a table object as I'd like...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi  Hennadii ,

     

    Sorry for the late reply.

    I have corrected my .pbix file according to your extra details,see below:

    Create 3 calculated columns as below:

     

     

    Group = RANKX(FILTER('Journal table','Journal table'[Task ID]=EARLIER('Journal table'[Task ID])&&'Journal table'[New Status]=10),[Date (m/d/y)],,ASC)
    Start date = 
    IF('Journal table'[Group]=1,'Journal table'[Create date],MINX(FILTER('Journal table','Journal table'[Task ID]=EARLIER('Journal table'[Task ID])&&'Journal table'[Group]=EARLIER('Journal table'[Group])),'Journal table'[Date (m/d/y)]))
    End date = 
    var _maxdate=MAXX(FILTER('Journal table','Journal table'[Task ID]=EARLIER('Journal table'[Task ID])&&'Journal table'[Group]=EARLIER('Journal table'[Group])),'Journal table'[Date (m/d/y)])
    Return
    IF('Journal table'[New Status]=10,'Journal table'[Date (m/d/y)],IF(_maxdate='Journal table'[Start date],BLANK(),_maxdate))

     

     

    As for "Initial status",there are 2 types of data,so you'd better create  a measure instead of column( 2 types are not supported in calculated column):

     

     

    Initial State = 
    var _max=CALCULATE(MAX('Journal table'[New Status]),FILTER(ALL('Journal table'),'Journal table'[Old Status]=10&&'Journal table'[Group]=MAX('Journal table'[Group])&&'Journal table'[Task ID]=MAX('Journal table'[Task ID])))
    Return
    IF(MAX('Journal table'[Group])=1,"Created",_max)

     

     

    But if you wanna create a relationship using this field,you can create a calculated column as below:(you need to change the format of the value to text as shown below);

     

    Initial status column = 
    var _max=CALCULATE(MAX('Journal table'[New Status]),FILTER('Journal table','Journal table'[Old Status]=10&&'Journal table'[Group]=EARLIER('Journal table'[Group])&&'Journal table'[Task ID]=EARLIER('Journal table'[Task ID])))
    Return
    IF('Journal table'[Group]=1,"Created",FORMAT(_max,"general number"))

     

    And you will see:

    For the related .pbix file,pls click here.

     

     
    Best Regards,
    Kelly
    Did I answer your question? Mark my post as a solution!