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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
POWER_MI
Post Patron
Post Patron

If condition for two rows

Hi, 

the table of data is on screen schoot. The objectif is to calculate the number of rows Ok and Ko where 

* Step S1,S2,S3

OK= Status 1,2,3

and KO =status 4

 

* Step S4

OK= Status 1

and KO =status 2,3,4

Is it possible to send if condition with count Row ?

thanks 

 

Capture2.PNG

1 ACCEPTED SOLUTION

Hi @POWER_MI ,

 

You can try this.

 

Column =
SWITCH (
    TRUE (),
    'Table'[Step] IN { 1, 2, 3 }
        && 'Table'[COLOR] IN { "R", "G", "O" }, "R1",
    'Table'[Step] IN { 1, 2, 3 }
        && 'Table'[COLOR] IN { "GR", "O", "Y" }, "R2",
    'Table'[Step] IN { 4, 5 }
        && 'Table'[COLOR] IN { "GR", "O", "Y" }, "R3",
    "Unknown"
)

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

9 REPLIES 9
Pragati11
Super User
Super User

Hi @POWER_MI ,

 

I am not very much clear on what you are trying to asking.

 

Can you simply create a sample input and sample output for your requirement?

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hi all, 

than,ks for feed back sorry if it's not clear, will try to re explain it.

the table is updated.

 

The asking is to have if or DAX conditions with if .... to deploy this condition 

 

The status Ok or KO depend on our scheduling if we are on step 1, 2 , 3 we can arange statuts of color Green and Orange to OK 

but after and on step 4 Orange will be KO because it's critiqual step SO OK = Green, and Orange and RED=KO

 

ConditionCapture6.PNG

So the objectif is to create new colonne and in this colon we will have like value OK or KO.

Condition is 

Table (colonne Step) & same table ( Color) : condition between this two colonne :

 

If we are on step 1 or 2 or 3 the ORANGE and GREEN Means Status OK and RED means KO

If we are on step 4 the GREEN Means Status OK. Orange and RED means KO

HI @POWER_MI ,

 

See if this works.

 

1.jpg

 

Create a new Column

 

Column = SWITCH(
    TRUE(),
    ('Table'[Step] = 4 && 'Table'[Color] IN {"ORANGE","RED"}) || ('Table'[Step] IN {1,2,3} && 'Table'[Color] = "RED") , "KO",
    "OK"

)

 

Regards,

HN

Capture253.PNGHello harshnathani thanks for your answer. It's not far i tried to make it on picture may be it's will be clean in same Switch condition we will have more conditions and the value at the last. i make example with color to understand

Hi @POWER_MI ,

 

Can you share all the conditions and sample data in text format with the expected output.

 

Very difficult to understand the requirement from the picture.

 

Regards,

HN

Hi all 

@harshnathani thanks for answer 

this is text condition

Column = SWITCH(
TRUE(),
(
'Table'[Step] IN {1,2,3} && 'Table'[COLOR] IN {"R","G","O"} ||
'Table'[Step] IN {1,2,3} && 'Table'[COLOR] IN {"GR","O","Y"} ||
'Table'[Step] IN {4,5} && 'Table'[COLOR] IN {"GR","O","Y"} ,
"R1",
"R2",
"R3",
"Unknow"
)


If table step = 1,2,3 and color is R,G,O value will be R1
If table step = 1,2,3 and color is GR,O,Y value will be R2
If table step = 3,4 and color is GR,O,Y value will be R3
else unknow

 

thanks 

Hi @POWER_MI ,

 

You can try this.

 

Column =
SWITCH (
    TRUE (),
    'Table'[Step] IN { 1, 2, 3 }
        && 'Table'[COLOR] IN { "R", "G", "O" }, "R1",
    'Table'[Step] IN { 1, 2, 3 }
        && 'Table'[COLOR] IN { "GR", "O", "Y" }, "R2",
    'Table'[Step] IN { 4, 5 }
        && 'Table'[COLOR] IN { "GR", "O", "Y" }, "R3",
    "Unknown"
)

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Hi @harshnathani

thanks it's working

best regards

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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