Forum Discussion

Creative_tree88's avatar
1 year ago
Solved

Calculating a date based on one variable in data

Hi all - I have some data (see sample).  I need to be able to produce a derived column in the dataset based on whatever the field is in column B (Type).  If it's Activity, then the date needs to show the date in column D (Event Date) and if it's Demand then it needs to show whatever date is in the Request Date column.  

 

I've shown this in the linked sample data, and the highlighted column in yellow (column E) is what it needs to show.  

 

Little stuck on this but I'm sure there must be a very simple way to calculate this, either in Power Query or as DAX.

 

Many thanks all!

 

Sample Data 

  • Hi Creative_tree88 

    This should be pretty straighforward either with DAX or Power Query unles you 're looking for something else.

     

6 Replies

  • Use Power Query. Go to the Add Column tab and choose Conditional Column. There you can plug in the values you need.

  • Hello Creative_tree88,
    create a calculated column
    Derived_date_column=
    if([Type]="Activity",[Event Date],[Request Date])


    if this hepls , please mark as solution

  • Hi Creative_tree88 

    This should be pretty straighforward either with DAX or Power Query unles you 're looking for something else.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Creative_tree88 

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Creative_tree88 
    I wanted to check if you had the opportunity to review the information provided by danextian , Vijay_Chethan  and johnt75 . Please feel free to contact us if you have any further questions. If their response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Creative_tree88 
    I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
    Thank you.