Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
I am creating a report to monitor which of my organization's agency partners have updated the plans assigned to them. The records in the database source are the plans. Some agencies have multiple plans which can have different plan statuses (see "Fire" and "Police" in the sample table below - each agency is responsible for two plans). The three possible values for [Plan Status] are "Complete", "Extension "Requested", and "No Response".
| Plan ID | Plan Name | Agency | Plan Status |
| 1 | Continuity Plan | Fire | Complete |
| 2 | Snow Plan | Sanitation | Extension Requested |
| 3 | Software Plan | Fire | No Response |
| 4 | Rainy Day Plan | Police | No Reponse |
| 5 | Search & Rescue Plan | Police | Extension Requested |
I am attempting to create a new field in Power BI called [Agency Status] that reports on the agency level rather than the plan level. The [Agency Status] field should have the same values as the [Plan Status] field. The logic should follow:
Based on this logic (which I am happy to clarify, the following [Agency Status] values should be:
| Plan ID | Plan Name | Agency | Plan Status | Agency Status |
| 1 | Back-up Plan | Fire | Complete | Complete |
| 2 | Snow Plan | Sanitation | Extension Requested | Extension Requested |
| 3 | Snow Plan | Fire | No Response | Complete |
| 4 | Rainy Day Plan | Police | No Reponse | Extension Requested |
| 5 | Back-up Plan | Police | Extension Requested | Extension Requested |
As always, I am happy to provide additional detail. Thank you to all those souls who venture to help our a DAX newbie such as myself!
Try this calculated column
Agency Status =
VAR CountPlans =
CALCULATE (
COUNT ( Table_Name[Plan Name] ),
ALLEXCEPT ( Table_Name, Table_Name[Agency] )
)
VAR mytable =
FILTER ( Table_Name, Table_Name[Agency] = EARLIER ( Table_Name[Agency] ) )
RETURN
IF (
CountPlans = 1,
Table_Name[Plan Status],
IF (
CONTAINS ( mytable, Table_Name[Plan Status], "Complete" ),
"Complete",
IF (
CONTAINS ( mytable, Table_Name[Plan Status], "Extension Requested" ),
"Extension Requested",
"No Response"
)
)
)
Thank you for the reply, @Zubair_Muhammad. When I add in the necessary table/field names, the calculation is able to run. Unfortunately the values for the number of agencies categorized as each Agency Status are not correct - particularly the count of agenciesthat should fall under "Extension Requested" and "No Response". As I am a beginner in the world of DAX, could you please explain the logic associated with those 2 in the caluclation you shared?
Hi Lewis.......When I use your sample data I get correct results... See the pic below
Could you share a instance where you get the incorrect Agency Status..... I will try to work it out
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 63 | |
| 55 | |
| 42 | |
| 41 | |
| 23 |
| User | Count |
|---|---|
| 167 | |
| 135 | |
| 120 | |
| 79 | |
| 53 |