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.
Hi, I need help to create DAX calcs for last 2 columns below. They are row level values but evaluated at aggregate project level. Thanks!
Project | Task | Task Status | 1 Project Status (If a Project has any task open project is open, otherwise closed) | 2 Mixed Task Status (If a Proejct has more than one Task Status Type) |
A | 1 | Closed | Closed | FALSE |
A | 2 | Closed | Closed | FALSE |
A | 3 | Closed | Closed | FALSE |
B | 1 | Open | Open | TRUE |
B | 2 | Closed | Open | TRUE |
B | 3 | Closed | Open | TRUE |
C | 1 | Open | Open | FALSE |
C | 2 | Open | Open | FALSE |
Solved! Go to Solution.
Hi, @Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create two measures as below.
Project Status =
var result =
CALCULATE(
DISTINCTCOUNT('Table'[Task]),
FILTER(
ALLEXCEPT('Table','Table'[Project]),
[Task Status]="Open"
)
)
return
IF(
result>0,
"Open",
"Closed"
)
Mixed Task Status =
var result =
CALCULATE(
DISTINCTCOUNT('Table'[Task Status]),
ALLEXCEPT('Table','Table'[Project])
)
return
IF(
result>1,
TRUE(),
FALSE()
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create two measures as below.
Project Status =
var result =
CALCULATE(
DISTINCTCOUNT('Table'[Task]),
FILTER(
ALLEXCEPT('Table','Table'[Project]),
[Task Status]="Open"
)
)
return
IF(
result>0,
"Open",
"Closed"
)
Mixed Task Status =
var result =
CALCULATE(
DISTINCTCOUNT('Table'[Task Status]),
ALLEXCEPT('Table','Table'[Project])
)
return
IF(
result>1,
TRUE(),
FALSE()
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Allan,
One further question on this. I start to get quickly confused when additional functions are used WITHIN the CALCUALTE function. What purpose does the ALLEXCEPT statement add to this calc? When I look up the defintion of ALLEXCEPT it states: "Removes all context filters in the table except filters that have been applied to the specified columns"
It seems to me it is ALSO controlling the context of which to evalaute the CALCULATE EXPRESSION. It appears to be evaluating the context within the Project level.
Can you explain what the ALLEXCEPT is doing? Thanks!
Thank you! This helps me tremendously!
@Anonymous try these measures
Open/Close =
VAR __rows = CALCULATE ( COUNTROWS ( Table ), ALLEXCEPT ( Table, Table[Project] ), Table[Status] = "Open" )
RETURN
IF ( ISBLANK ( __rows ), "Closed", "Open" )
Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020
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.
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 |
---|---|
104 | |
101 | |
79 | |
72 | |
64 |
User | Count |
---|---|
142 | |
108 | |
101 | |
81 | |
74 |