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 all,
I have two datasets:
Applications, where each of them can be in one of three statuses: In Production, Ready for Production and Dismissed
Application Name | Application Status |
Application1 | In production |
Application2 | Ready for production |
Application3 | In production |
Application4 | Dismissed |
Application5 | Ready for production |
And Components, where each component can be in one of two statuses: Complete and Incomplete
Component Name | Component Status | Application Link |
Component1 | Complete | Application1 |
Component2 | Complete | Application2 |
Component3 | Incomplete | Application2 |
Component4 | Incomplete | Application2 |
Component5 | Complete | Application3 |
Component6 | Complete | Application3 |
Component7 | Complete | Application4 |
Component8 | Incomplete | Application4 |
Component9 | Complete | Application5 |
Component10 | Incomplete | Application5 |
Tables have an established relationship
I have a matrix with a hierarchy and statuses of application and components.
If all Components in the Application have the same status, I show this status, otherwise I put a number of Components:
Measure Component Status = SELECTEDVALUE('Components'[Component Status], DISTINCTCOUNT(Components[Component Name]))
What I want to have is a new Boolean column (Y/N) at Application level to catch discrepancies between the statuses of Applications and Components following this logic:
Would you please advise how to do that?
Thank you!
My attempt is just using a lot of switch cases to match the logic given:
Discrepancy =
var relatedStatuses = SELECTCOLUMNS(RELATEDTABLE(Components), "status", Components[Component Status])
return SWITCH(TRUE(),
Applications[Application Status] = "In Production" && NOT("Incomplete" in relatedStatuses), "No",
Applications[Application Status] = "Ready for Production", "No",
Applications[Application Status] = "Dismissed" && NOT("Complete" in relatedStatuses), "No",
"Yes"
)
User | Count |
---|---|
78 | |
77 | |
37 | |
33 | |
31 |
User | Count |
---|---|
92 | |
81 | |
58 | |
48 | |
48 |