Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I am trying to identify
1. for < than 100% complete milestones, it needs to return the first late milestone task by finish date and a status string indicating which task is late and by how many days.
2. for =100% complete, it needs to return the last milestone and say "finished on time"
DAX below gives error: "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value".
Solved! Go to Solution.
This error shows up because you're trying to use a table (like what TOPN returns) where Power BI is expecting just one value—like when you're combining text or checking a condition.
You've already used MAXX(...) to get the task name and finish date from the filtered table. So instead of using LastCompletedTask (which is still a table), you should use the variable that holds the actual task name.
Just update this line:
LastCompletedTask & " finished on time"
to
BaselineCompletedTask & " finished on time"
The corrected DAX formula:
FirstLateMilestoneTask =
VAR TodayDate = TODAY()
-- Tasks that are late
VAR LateTasks =
FILTER (
msdyn_projecttask,
msdyn_projecttask[Schedule Status] = "Off Schedule"
&& msdyn_projecttask[Required Tasks.Flag] = "y"
&& msdyn_projecttask[% Complete] < 1
&& NOT ISBLANK ( msdyn_projecttask[Baseline Finish] )
)
VAR FirstLateTask =
TOPN ( 1, LateTasks, msdyn_projecttask[Baseline Finish], ASC )
VAR TaskName =
MAXX ( FirstLateTask, msdyn_projecttask[Project Task Name] )
VAR FinishDate =
MAXX ( FirstLateTask, msdyn_projecttask[Finish] )
VAR FinishDaysLate =
DATEDIFF ( FinishDate, TodayDate, DAY )
-- Tasks that are done
VAR CompletedTasks =
FILTER (
msdyn_projecttask,
msdyn_projecttask[Schedule Status] <> "Off Schedule"
&& msdyn_projecttask[Required Tasks.Flag] = "y"
&& msdyn_projecttask[% Complete] = 1
&& NOT ISBLANK ( msdyn_projecttask[Baseline Finish] )
)
VAR LastCompletedTask =
TOPN ( 1, CompletedTasks, msdyn_projecttask[Finish], DESC )
VAR BaselineCompletedTask =
MAXX ( LastCompletedTask, msdyn_projecttask[Project Task Name] )
VAR BaselineFinishDate =
MAXX ( LastCompletedTask, msdyn_projecttask[Baseline Finish] )
VAR ActualFinishDate =
MAXX ( LastCompletedTask, msdyn_projecttask[Finish] )
VAR BaselineFinishDaysLate =
DATEDIFF ( BaselineFinishDate, ActualFinishDate, DAY )
RETURN
SWITCH (
TRUE (),
NOT ISBLANK ( TaskName ),
TaskName & " is " & FinishDaysLate & " days past the expected completion date",
BaselineFinishDaysLate = 0,
BaselineCompletedTask & " finished on time",
BLANK()
)
Let me know if you're pulling data from other related tables, or if you're using slicers in your report—I'm happy to help fine-tune it!
Feel free to share if it worked for you!
If it solves your issue, feel free to mark it as the accepted solution so others can benefit as well. And if you found it helpful, a thumbs-up is always appreciated!
I had to separate the above DAX into 2 measures. One for Late Tasks, the other for completed ones. They both worked.
I had to separate the above DAX into 2 measures. One for Late Tasks, the other for completed ones. They both worked.
Hi @PC2022 ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you @techies for the prompt response.
Yes - the error you're getting ("The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value".) comes from this part:
LastCompletedTask & " finished on time"
LastCompletedTask is a table (result of TOPN), and you're trying to concatenate it with text, which requires a scalar value.
I have created a measure called "FirstLateMilestoneTask" in the attached pbix file which can solve the issue, please go through it.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Not working. I am trying to figure it out and will post once i do.
This error shows up because you're trying to use a table (like what TOPN returns) where Power BI is expecting just one value—like when you're combining text or checking a condition.
You've already used MAXX(...) to get the task name and finish date from the filtered table. So instead of using LastCompletedTask (which is still a table), you should use the variable that holds the actual task name.
Just update this line:
LastCompletedTask & " finished on time"
to
BaselineCompletedTask & " finished on time"
The corrected DAX formula:
FirstLateMilestoneTask =
VAR TodayDate = TODAY()
-- Tasks that are late
VAR LateTasks =
FILTER (
msdyn_projecttask,
msdyn_projecttask[Schedule Status] = "Off Schedule"
&& msdyn_projecttask[Required Tasks.Flag] = "y"
&& msdyn_projecttask[% Complete] < 1
&& NOT ISBLANK ( msdyn_projecttask[Baseline Finish] )
)
VAR FirstLateTask =
TOPN ( 1, LateTasks, msdyn_projecttask[Baseline Finish], ASC )
VAR TaskName =
MAXX ( FirstLateTask, msdyn_projecttask[Project Task Name] )
VAR FinishDate =
MAXX ( FirstLateTask, msdyn_projecttask[Finish] )
VAR FinishDaysLate =
DATEDIFF ( FinishDate, TodayDate, DAY )
-- Tasks that are done
VAR CompletedTasks =
FILTER (
msdyn_projecttask,
msdyn_projecttask[Schedule Status] <> "Off Schedule"
&& msdyn_projecttask[Required Tasks.Flag] = "y"
&& msdyn_projecttask[% Complete] = 1
&& NOT ISBLANK ( msdyn_projecttask[Baseline Finish] )
)
VAR LastCompletedTask =
TOPN ( 1, CompletedTasks, msdyn_projecttask[Finish], DESC )
VAR BaselineCompletedTask =
MAXX ( LastCompletedTask, msdyn_projecttask[Project Task Name] )
VAR BaselineFinishDate =
MAXX ( LastCompletedTask, msdyn_projecttask[Baseline Finish] )
VAR ActualFinishDate =
MAXX ( LastCompletedTask, msdyn_projecttask[Finish] )
VAR BaselineFinishDaysLate =
DATEDIFF ( BaselineFinishDate, ActualFinishDate, DAY )
RETURN
SWITCH (
TRUE (),
NOT ISBLANK ( TaskName ),
TaskName & " is " & FinishDaysLate & " days past the expected completion date",
BaselineFinishDaysLate = 0,
BaselineCompletedTask & " finished on time",
BLANK()
)
Let me know if you're pulling data from other related tables, or if you're using slicers in your report—I'm happy to help fine-tune it!
Feel free to share if it worked for you!
If it solves your issue, feel free to mark it as the accepted solution so others can benefit as well. And if you found it helpful, a thumbs-up is always appreciated!
Not working. I am trying to figure it out and will post once i do.
Hi @PC2022 please share the sample of your data model or pbix file?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
7 | |
6 |
User | Count |
---|---|
14 | |
13 | |
11 | |
9 | |
8 |