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.
Hi there,
I'm writing a DAX measure that I'd like to return multiple rows for every condition evaluated as TRUE.
I have the following, for example:
VAR maritalStatus = SELECTEDVALUE('New Client Intake Responses'[Marital Status])
VAR atRiskOfDivorce = SELECTEDVALUE('FamilyLife Profile'[Change in marital status (divorce)])
VAR atRiskOfWidowhood = SELECTEDVALUE('FamilyLife Profile'[Change in marital status (widowhood)])
RETURN
SWITCH(
TRUE(),
maritalStatus = "Married" && atRiskOfDivorce IN {"Currently experiencing", "Anticipate short- to mid-term", "Anticipate long-term"}, "Div Risk (set tax status to MFS)",
maritalStatus = "Married" && atRiskOfWidowhood IN {"Currently experiencing", "Anticipate short- to mid-term"}, "Anticipated loss of spouse"
)
In the case above, it's possible for both of the criteria to be true. And if both are true, I'd like this measure to return both
Solved! Go to Solution.
I think getting to an answer would require more sophisticated DAX than I'm able to come up with, so I've modified the data model instead. Closing this one out. Thanks anyway for all who viewed and to @amitchandak for the opening shot!
@dkenniston , based on what I got, you need a measure like
VAR maritalStatus = SELECTEDVALUE('New Client Intake Responses'[Marital Status])
VAR atRiskOfDivorce = SELECTEDVALUE('FamilyLife Profile'[Change in marital status (divorce)])
VAR atRiskOfWidowhood = SELECTEDVALUE('FamilyLife Profile'[Change in marital status (widowhood)])
RETURN Countrow(filter(Table, not(Isblank(
SWITCH(
TRUE(),
maritalStatus = "Married" && atRiskOfDivorce IN {"Currently experiencing", "Anticipate short- to mid-term", "Anticipate long-term"}, "Div Risk (set tax status to MFS)",
maritalStatus = "Married" && atRiskOfWidowhood IN {"Currently experiencing", "Anticipate short- to mid-term"}, "Anticipated loss of spouse"
))) ) )
Hi @amitchandak, thank you so much for the response!
Just tried adding COUNTROWS(FILTER('New Client Intake Responses', NOT(ISBLANK(
before the SWITCH statement.
It returned the number 1.
Open to other suggestions though - thanks again!
I think getting to an answer would require more sophisticated DAX than I'm able to come up with, so I've modified the data model instead. Closing this one out. Thanks anyway for all who viewed and to @amitchandak for the opening shot!
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 | |
8 | |
8 | |
6 | |
5 |
User | Count |
---|---|
17 | |
14 | |
10 | |
9 | |
6 |