Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Dear community,
I want to create new columns based on other columns from another table using IF-condition. I hope you can help me. Image I have the following two tables
Table1:
ID
1
2
3
Table2:
ID Status Time
1 New 5
1 In progress 10
2 New 7
2 In Progress 12
3 New 15
3 In Progress 20
I want to add new colums to the table1. Table1 should like this:
ID Time new Time in progress
1 5 10
2 7 12
3 15 20
There is a n:1-relation between the two tables.
How can I create the columns Time new and Time in progress?
Thank you very much and kind regards.
Solved! Go to Solution.
Hi @Learner86
Time new =
MAXX (
FILTER ( RELATEDTABLE ( Table2 ), Table2[Status] = "New" ),
Table2[Time]
)
Time In Progress =
MAXX (
FILTER ( RELATEDTABLE ( Table2 ), Table2[Status] = "In Progress" ),
Table2[Time]
)
Hi @Learner86
Time new =
MAXX (
FILTER ( RELATEDTABLE ( Table2 ), Table2[Status] = "New" ),
Table2[Time]
)
Time In Progress =
MAXX (
FILTER ( RELATEDTABLE ( Table2 ), Table2[Status] = "In Progress" ),
Table2[Time]
)
Many thanks for the proposed solution. There is just one point: How can I combine the two tables by using of the ID-columns?
@Learner86
Can you please provide the expected output? Do you want that using M or DAX?
Check this post, it might help you to solve your issue.
Since related works from one side of the relationship it won't fulfill your need but you can try related table.
Thanks,
Arul
@Arul : Thanks for your answer. Unfortunately, the recommended solution doesn't work in my case.
User | Count |
---|---|
16 | |
15 | |
14 | |
12 | |
11 |
User | Count |
---|---|
19 | |
15 | |
14 | |
11 | |
9 |