The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi team,
I am having issues while creating new column "Shipping Status" with below logic.
Relationship --> A given project contains multiple tasks. Any help will be much appreciated.
Project | Task Id | Task Name | Shipping Status |
1 | 1 | Task 11 | Pre-Shipping |
1 | 2 | Task 12 | Pre-Shipping |
1 | 3 | Shipping | Shipping |
1 | 4 | Task 14 | Post-Shipping |
1 | 5 | Task 15 | Post-Shipping |
2 | 1 | Task 21 | Pre-Shipping |
2 | 2 | Task 22 | Pre-Shipping |
2 | 3 | Shipping | Shipping |
2 | 4 | Task 23 | Post-Shipping |
Solved! Go to Solution.
Hi, @ankitkalsara
Please try the below for creating a new column.
Shipping Status Column =
VAR currentproject = 'Table'[Project ]
VAR shippingtaskid =
CALCULATE (
SELECTEDVALUE ( 'Table'[Task Id] ),
FILTER (
ALL ( 'Table' ),
'Table'[Project ] = currentproject
&& 'Table'[Task Name] = "Shipping"
)
)
RETURN
SWITCH (
TRUE (),
'Table'[Task Id] < shippingtaskid
&& 'Table'[Project ] = currentproject, "Pre-Shipping",
'Table'[Task Id] > shippingtaskid
&& 'Table'[Project ] = currentproject, "Post-Shipping",
"Shipping"
)
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: https://www.linkedin.com/in/jihwankim1975/
Hi, @ankitkalsara
Please try the below for creating a new column.
Shipping Status Column =
VAR currentproject = 'Table'[Project ]
VAR shippingtaskid =
CALCULATE (
SELECTEDVALUE ( 'Table'[Task Id] ),
FILTER (
ALL ( 'Table' ),
'Table'[Project ] = currentproject
&& 'Table'[Task Name] = "Shipping"
)
)
RETURN
SWITCH (
TRUE (),
'Table'[Task Id] < shippingtaskid
&& 'Table'[Project ] = currentproject, "Pre-Shipping",
'Table'[Task Id] > shippingtaskid
&& 'Table'[Project ] = currentproject, "Post-Shipping",
"Shipping"
)
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: https://www.linkedin.com/in/jihwankim1975/
Hi @Jihwan_Kim ,
Thank you very much for the suggestion, it works exactly the way I wanted 🙂
User | Count |
---|---|
13 | |
8 | |
7 | |
6 | |
5 |
User | Count |
---|---|
21 | |
15 | |
15 | |
10 | |
7 |