Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a table, "PlannerTaskInformation", in BI that pulls project data from Microsoft Planner. I'm trying to create a measure that returns the value of the TaskCompletedDate column, if the Tasks column equals "On Hold". This much I was able to do using the following:
On Hold - Completed Date =
CALCULATE(
MAX('PlannerTaskInformation'[TaskCompletedDate]),
FILTER(PlannerTaskInformation, PlannerTaskInformation[Tasks] = { "On Hold" } ))
Now I'd like to add one more layer to that. If the Task column equals "On Hold", but the TaskCompletedDate column is blank, I'd like to return the text "Active"
PROJECT | TASK | TASKCOMPLETEDDATE | DESIRED MEASURE OUTPUT |
B | Clean Up Items | ||
B | Design | ||
B | Phase 1: Set-Up | 07/28/2020 | |
B | Phase 2: Velocity | 01/12/2021 | |
B | Phase 3: Testing and Retesting | 07/27/2020 | |
B | Phase 4: Deployment | 01/12/2021 | |
B | Phase 5: Maintenance | 01/12/2021 | |
B | On Hold | 01/12/2021 | 01/12/2021 |
C | Clean Up Items | ||
C | Design | ||
C | Phase 1: Set-Up | ||
C | Phase 2: Velocity | 01/13/2021 | |
C | Phase 3: Testing and Retesting | 12/15/2020 | |
C | Phase 4: Deployment | ||
C | Phase 5: Maintenance | ||
C | On Hold | Active |
I tried to do something using SWITCH, but was unsuccessful. This will no doubt reveal what a BI novice I am, but it's as far as I could take it. Thanks in advance!
On Hold - Completed Date =
SWITCH (
TRUE (),
MAX(PlannerTaskInformation[Tasks] = "On Hold" && MAX('PlannerTaskInformation'[TaskCompletedDate]) <> BLANK(), PlannerTaskInformation'[TaskCompletedDate],
MAX(PlannerTaskInformation[Tasks] = "On Hold" && MAX('PlannerTaskInformation'[TaskCompletedDate]) = BLANK(), "Active")
Solved! Go to Solution.
@BigFella This should be straight forward, add a column:
Desired Output Column =
IF (
Table[Task] = "On Hold",
IF ( ISBLANK ( Table[TaskcompletedDate] ) , "Active", FORMAT(Table[TaskCompleteDate], "MM/dd/yyyy" )
)
)
Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k When I use this new column in conjunction with another measure, I'm running into an issue. I have a "Project Risks" table visual that needs to show both Unassigned Tasks and the On Hold Completed Date on a single row per project.
As noted above, the On Hold Completed column uses "Active" if the TaskCompletedDate column is blank, and the date from the TaskCompletedDate column if its populated. Unassigned Tasks is the measure below:
Unassigned Tasks =
CALCULATE(COUNTBLANK('PlannerTaskInformation'[Task Assigned User]),
FILTER(PlannerTaskInformation, PlannerTaskInformation[TaskCompletedDate] = BLANK() ))
Because the measure filters for when TaskCompletedDate is blank, and the On Hold Completed column can include instances where TaskCompletedDate is not blank, I can't get these on a single row. Instead I end up with this:
Project | OnHold-StartDate | TaskCompletedDate | OnHold-CompletedColumn | UnassignedTasks |
A | 1 | |||
B | 01/07/21 | Active | 1 | |
C | 3 | |||
C | 11/18/20 | 01/13/21 | 1/13/2021 | |
D | 2 |
When what I want is this:
Project | OnHold-StartDate | TaskCompletedDate | OnHold-CompletedColumn | UnassignedTasks |
A | 1 | |||
B | 01/07/21 | Active | 1 | |
C | 11/18/20 | 01/13/21 | 1/13/2021 | 3 |
D | 2 |
*(The final table will not show TaskCompletedDate, that is included in this example for illustrative purposes only)
Is there a way to get these two columns to play nice and condense data to a single row per project? I tried rewriting the measure as shown below, but it gave me the same result:
Unassigned Tasks =
CALCULATE(COUNTBLANK('PlannerTaskInformation'[Task Assigned User]),
PlannerTaskInformation[TaskCompletedDate] = BLANK() )
Thank you
@BigFella This should be straight forward, add a column:
Desired Output Column =
IF (
Table[Task] = "On Hold",
IF ( ISBLANK ( Table[TaskcompletedDate] ) , "Active", FORMAT(Table[TaskCompleteDate], "MM/dd/yyyy" )
)
)
Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I had picked up in my self-taught BI crash course that measures were preferred, so I was trying to force it as such, but the column definitely worked like a charm here. Thanks a million, and thanks for all the other answers on this forum too, I've learned a lot just cruising these posts!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
105 | |
79 | |
69 | |
62 |
User | Count |
---|---|
142 | |
105 | |
103 | |
85 | |
70 |