Hi All,
I have two tables(A, B).
Table A
Task id | Title | Created Date |
1 | Title 1 | 13-05-2020 |
2 | Title 2 | 10-02-2020 |
3 | Title 3 | 23-03-2020 |
4 | Title 4 | 13-12-2019 |
5 | Title 5 | 10-04-2020 |
Table B:
Start Date | End date | Iteration Number |
01-12-2019 | 31-12-2019 | 1 |
01-01-2020 | 31-01-2020 | 2 |
01-02-2020 | 29-02-2020 | 3 |
01-03-2020 | 31-03-2020 | 4 |
01-04-2020 | 30-04-2020 | 5 |
01-05-2020 | 31-05-2020 | 6 |
And the result table should be:
Task id | Title | Created Date | Iteration Number |
1 | Title 1 | 13-05-2020 | 6 |
2 | Title 2 | 10-02-2020 | 3 |
3 | Title 3 | 23-03-2020 | 4 |
4 | Title 4 | 13-12-2019 | 1 |
5 | Title 5 | 10-04-2020 | 5 |
I want to add a column into table A which should be Iteration Number by comparing Created Date in between Start Date and End date.
I tried by merging two tables, appending it, adding a conditional column, custom column but nothing worked as expected.
I need a suggestion on how to handle this.
Thanks in advance.
Solved! Go to Solution.
@essakkiappan , new column in table A. Add conditions if needed
New column in Table A = minx(filter(TableB, TableB[StartDate]<= TableA[Created date] && TableB[End Date]>= TableA[Created date]),TableB[Iteration Number])
Proud to be a Super User!
@essakkiappan , new column in table A. Add conditions if needed
New column in Table A = minx(filter(TableB, TableB[StartDate]<= TableA[Created date] && TableB[End Date]>= TableA[Created date]),TableB[Iteration Number])
Proud to be a Super User!
Thanks @amitchandak for the response. I'm new to PowerBI. When I try to add the formula you gave in the Custom Column window, I'm not getting the Table B column[StartDate/EndDate].
Any idea?
@essakkiappan , Are you doing it in power query/edit query mode or new column in data mode.
Column name you can let power BI auto-suggest, keep on typing formula
Proud to be a Super User!
@amitchandak I'm doing it in power query editor mode. I'm not getting the power BI suggestion for Table B column name. and I get the Token Literal Expected error when I add the column name manually.
@essakkiappan, I suggested a Dax column, So if this can help in case of power Query
https://radacad.com/append-vs-merge-in-power-bi-and-power-query
Proud to be a Super User!
Thanks, @amitchandak I have tried with merge and append but that's not solving my purpose.
I'm checking how to add Dax column. will try with your solution once I know how to add Dax column.
Thanks!!
@essakkiappan did you tested the expression I provided, as mentioned, make sure change table and column name as per your model, we have used dummy table and column name to provide the solution, you have to change it as per your pbix.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@essakkiappan add the following column in your Task table
Iteration =
VAR __createdDate = Tasks[Created Date]
RETURN
CALCULATE ( MAX ( Iteration[Iternation] ), __createdDate >= Iteration[Start], __createdDate <= Iteration[End] )
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Power BI User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.
User | Count |
---|---|
399 | |
136 | |
108 | |
85 | |
53 |
User | Count |
---|---|
422 | |
157 | |
139 | |
115 | |
84 |