Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi Gurus,
I just need to know can we create a DAX calculations using parent child recursive options,
here is a case.
Project > Idea >PBI > Task
Now i need to calculates time of task but dax will start from project using parent shild relationship.
Solved! Go to Solution.
Yes, it is possible to create recursive calculations in DAX (Data Analysis Expressions) using parent-child relationships. In your case, you want to calculate the time of tasks starting from the project level using the parent-child hierarchy of Project > Idea > PBI > Task.
Here's a general approach you can follow:
Define the Parent-Child Relationship: Ensure that your data model has a proper parent-child relationship established between Project, Idea, PBI, and Task entities.
Create a DAX Measure for Recursive Calculation: You will need to create a DAX measure that recursively calculates the time of tasks starting from the project level.
Utilize DAX Functions: DAX offers functions like PATH, PATHITEM, and PATHCONTAINS that can be helpful in dealing with parent-child hierarchies.
Here's a simplified example of how you might write a DAX measure for recursive calculation:
RecursiveTaskTime =
VAR CurrentProject = SELECTEDVALUE('Project'[ProjectName])
RETURN
IF (
ISFILTERED('Task'[TaskName]), -- Check if we are at the Task level
CALCULATE(
SUM('Task'[Time]), -- Calculate the time of the task
FILTER(
ALL('Task'),
'Task'[TaskName] = SELECTEDVALUE('Task'[TaskName]) -- Filter to the specific task
)
),
-- Otherwise, we need to go up the hierarchy
CALCULATE(
SUM('Task'[Time]), -- Calculate the time at the current level
FILTER(
ALL('Project'),
'Project'[ProjectName] = CurrentProject -- Filter to the current project
)
) + [RecursiveTaskTime] -- Add the time of child PBIs and Tasks recursively
)
Please note that this is a simplified example, and you may need to adapt it to fit your specific data model and requirements. Additionally, recursive calculations in DAX can be resource-intensive, so it's important to test the performance of your measures, especially with large datasets.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
Yes, it is possible to create recursive calculations in DAX (Data Analysis Expressions) using parent-child relationships. In your case, you want to calculate the time of tasks starting from the project level using the parent-child hierarchy of Project > Idea > PBI > Task.
Here's a general approach you can follow:
Define the Parent-Child Relationship: Ensure that your data model has a proper parent-child relationship established between Project, Idea, PBI, and Task entities.
Create a DAX Measure for Recursive Calculation: You will need to create a DAX measure that recursively calculates the time of tasks starting from the project level.
Utilize DAX Functions: DAX offers functions like PATH, PATHITEM, and PATHCONTAINS that can be helpful in dealing with parent-child hierarchies.
Here's a simplified example of how you might write a DAX measure for recursive calculation:
RecursiveTaskTime =
VAR CurrentProject = SELECTEDVALUE('Project'[ProjectName])
RETURN
IF (
ISFILTERED('Task'[TaskName]), -- Check if we are at the Task level
CALCULATE(
SUM('Task'[Time]), -- Calculate the time of the task
FILTER(
ALL('Task'),
'Task'[TaskName] = SELECTEDVALUE('Task'[TaskName]) -- Filter to the specific task
)
),
-- Otherwise, we need to go up the hierarchy
CALCULATE(
SUM('Task'[Time]), -- Calculate the time at the current level
FILTER(
ALL('Project'),
'Project'[ProjectName] = CurrentProject -- Filter to the current project
)
) + [RecursiveTaskTime] -- Add the time of child PBIs and Tasks recursively
)
Please note that this is a simplified example, and you may need to adapt it to fit your specific data model and requirements. Additionally, recursive calculations in DAX can be resource-intensive, so it's important to test the performance of your measures, especially with large datasets.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
21 | |
20 | |
19 | |
13 | |
12 |
User | Count |
---|---|
41 | |
29 | |
23 | |
22 | |
22 |