Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
Hi all,
I'd like to create a DAX column which returns a text value with rules.
I tried with a SWITCH True formula, but (as expected) it didn't work, because the conditions only applies for one row after another. The rules should apply to the column Account with the same value. For example Account = A has three rows. The 3rd row in the new column "defined" should be "Good" as well, because Account A has Category = "Done" in the first two rows.
The same applies to the other marked rows.
Thank you a lot for your help.
Solved! Go to Solution.
@Anonymous
Add the following code as anew column to your table:
Defined =
IF(
ISEMPTY( FILTER( Accounts , Accounts[Account] = EARLIER(Accounts[Account]) && Accounts[Category] = "Done")),
"In Progress",
"Done"
)
________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Hi,
This calculated column formula works
=if(AND(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Account]=EARLIER(Data[Account])&&(Data[Category]="Done"||Data[Category]="Unfinished")))=CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Account]=EARLIER(Data[Account]))),CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Account]=EARLIER(Data[Account])&&Data[Category]="Done"))>=1),"Good","In progress")
Hope this helps.
@Anonymous
Add the following code as anew column to your table:
Defined =
IF(
ISEMPTY( FILTER( Accounts , Accounts[Account] = EARLIER(Accounts[Account]) && Accounts[Category] = "Done")),
"In Progress",
"Done"
)
________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Hi @Anonymous
take a look at the folowing solution:
Defined =
VAR _Text = CONCATENATEX(VALUES('Table'[Category]),'Table'[Category])
RETURN
SWITCH(TRUE(),
_Text = "Done" , "Good",
_Text = "Unfinished" , "In Progress",
"Good"
)
With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)
@mahoneypat Thx, but didn't work.
thanks. I tried the same solution, but in my case Account C is still "Good" instead of "In Progress".
What is different in my new column?
Switch True returns the first one that's true. All you need to do is change the order. Put the one with && as the second one.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 79 | |
| 38 | |
| 31 | |
| 27 | |
| 27 |