Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Limerick
Frequent Visitor

Insert value in group of data depending on value from other column

Hello together, 

 

I'm struggeling with a new little Problem.
I have this Table with a lot more rows, but these two rows are the most important:

IDState
1Error
1Error
1OK
2Error
2Error
2OK
3Error
3Error

 

As you can see, the ID can get two different states. I now need to create a third row, which says that if the ID has once the state OK, then it is OK for every state:

IDStateCode
1ErrorOK
1ErrorOK
1OKOK
2ErrorOK
2ErrorOK
2OKOK
3ErrorError
3ErrorError

 

It doesnt matter if it is in DAX or in the Query. 

Thank you in advance 🙂 

1 ACCEPTED SOLUTION
jaideepnema
Solution Sage
Solution Sage

Hi @Limerick ,

Create a calculated column like this:

Code =
var statecheck=CALCULATE(CONCATENATEX('Table','Table'[State],","),ALLEXCEPT('Table','Table'[ID]))
var findvalue=CONTAINSSTRING(statecheck,"OK")
return IF(findvalue,"OK",'Table'[State])
 
which will give you the desired result:
jaideepnema_0-1633011041908.png

Please accept this as a solution if your question has been answered !!

Appreciate a Kudos 😀

View solution in original post

2 REPLIES 2
jaideepnema
Solution Sage
Solution Sage

Hi @Limerick ,

Create a calculated column like this:

Code =
var statecheck=CALCULATE(CONCATENATEX('Table','Table'[State],","),ALLEXCEPT('Table','Table'[ID]))
var findvalue=CONTAINSSTRING(statecheck,"OK")
return IF(findvalue,"OK",'Table'[State])
 
which will give you the desired result:
jaideepnema_0-1633011041908.png

Please accept this as a solution if your question has been answered !!

Appreciate a Kudos 😀

Very nice!
Thank you very much 🙂 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.