Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Dynamic Column for Order Date and Static Date

I have Two Tables with the following columns. They have a one to many relationship.

1. Sales (table)

  • Order Date

2.Information (table)

  • Start Date
  • Identifier Name

 

I would like to make a column on the sales table that will return "pre" or "post" depending if the Order date is before or after the start date. The start date is static and will never change and the order date is the date of when the order was made and has a lot of differnet dates. I would like the User to be able to select thier preferred identifier name and then the column on the sales table will update all the record with pre or post accordingly. Any tip or methods to do this are appreciated. 

2 Replies

  • kpost's avatar
    kpost
    Solution Sage

    pre_or_post = 
    var v1 = [order date]
    var v2 = RELATED(Information[Start date])
    return
    IF(v1 <= v2, "pre", "post")

    Does this work?

    //Mediocre Power BI advice, but it's free//

    • Anonymous's avatar
      Anonymous
      Not applicable

      This is close but when I make a slicer and slice by identifier name it will only show me the pre values and not the post values. So in a table this would show but i would want it to have two rows for each identifier name, one for pre and one for post.

       

      pre or postcount of ordersidentifier name
      post1000 
      pre399test1
      pre267test2