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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Comparing the row values based on the conditional category for each group

Hi,

 

Here are the data and the expected result. I want to compare the values based on the "Rule", which the relationship for "Tier",  to get the expected result, "pass" or "fail" for each Level using dax.  How can I get this ?  Thanks

 

jmywang_0-1625457376007.png

 

 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Picture1.png

 

New Table =
VAR steponetable =
SUMMARIZE (
data,
data[id],
'level'[level],
tier[Index],
data[tier],
data[value]
)
VAR steptwotable =
ADDCOLUMNS (
steponetable,
"@lowertiersmaxvalue",
CALCULATE (
VAR currentlevel =
MAX ( 'level'[level] )
VAR currenttier =
MAX ( tier[Index] )
RETURN
MAXX (
FILTER (
steponetable,
'level'[level] = currentlevel
&& tier[Index] < currenttier
),
data[value]
)
)
)
VAR stepfourtable =
ADDCOLUMNS (
steptwotable,
"@result column",
IF (
COUNTROWS (
FILTER (
steptwotable,
'level'[level] = EARLIER ( 'level'[level] )
&& data[value] < [@lowertiersmaxvalue]
)
) > 0,
"Fail",
"Pass"
)
)
RETURN
SUMMARIZE (
stepfourtable,
data[id],
'level'[level],
data[tier],
data[value],
[@result column]
)
 
 
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Picture1.png

 

New Table =
VAR steponetable =
SUMMARIZE (
data,
data[id],
'level'[level],
tier[Index],
data[tier],
data[value]
)
VAR steptwotable =
ADDCOLUMNS (
steponetable,
"@lowertiersmaxvalue",
CALCULATE (
VAR currentlevel =
MAX ( 'level'[level] )
VAR currenttier =
MAX ( tier[Index] )
RETURN
MAXX (
FILTER (
steponetable,
'level'[level] = currentlevel
&& tier[Index] < currenttier
),
data[value]
)
)
)
VAR stepfourtable =
ADDCOLUMNS (
steptwotable,
"@result column",
IF (
COUNTROWS (
FILTER (
steptwotable,
'level'[level] = EARLIER ( 'level'[level] )
&& data[value] < [@lowertiersmaxvalue]
)
) > 0,
"Fail",
"Pass"
)
)
RETURN
SUMMARIZE (
stepfourtable,
data[id],
'level'[level],
data[tier],
data[value],
[@result column]
)
 
 
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

@Jihwan_Kim 

 

Very appreciated that. Let me figure it out all.  Thanks.

Anonymous
Not applicable

@amitchandak 

 

Can you explain the function you wrote?  Because I can't understand why you used the LEFT function to extract the first characters from [Position], the column, [Position], represents a set of group that it shouldn't contain any additional information in that equation.

To clarify my question, under the each of group ([Position]), I want to check whether the values, which is split into three levels, would follow the rule or not.  That's to say, we don't need to care about the difference of values in the same [position] and the same [tier].    Thank you.

amitchandak
Super User
Super User

@Anonymous , Based on what I got Try a new column as

 


new column =
if(search(left(level],1), [Rule],,0) <= search([tier] [Rule],,0), "Pass", "Fail")

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.