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.
With some help from this community I have the following Dax code that is doing the following:
Solved! Go to Solution.
HI @Roym
Please try
Column =
VAR CurrentTest = 'Table'[Test]
VAR CurrentReview = 'Table'[Review]
VAR CurrentID = 'Table'[ID]
VAR CurrentsessionTable =
CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[session] ) )
VAR PreviousRecords =
FILTER (
CurrentsessionTable,
'Table'[ID] < CurrentID
&& 'Table'[Review] <> "Open"
)
VAR PreviousRecord =
TOPN ( 1, PreviousRecords, 'Table'[ID] )
VAR PreviousReview =
MAXX ( PreviousRecord, 'Table'[Review] )
VAR Result =
IF (
CurrentTest = "Effective",
SWITCH (
CurrentReview,
"Effective", "Effective",
"Ineffective", "Ineffective",
"Open", PreviousReview
)
)
RETURN
COALESCE ( Result, 'Table'[Test] )
HI @Roym
Please try
Column =
VAR CurrentTest = 'Table'[Test]
VAR CurrentReview = 'Table'[Review]
VAR CurrentID = 'Table'[ID]
VAR CurrentsessionTable =
CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[session] ) )
VAR PreviousRecords =
FILTER (
CurrentsessionTable,
'Table'[ID] < CurrentID
&& 'Table'[Review] <> "Open"
)
VAR PreviousRecord =
TOPN ( 1, PreviousRecords, 'Table'[ID] )
VAR PreviousReview =
MAXX ( PreviousRecord, 'Table'[Review] )
VAR Result =
IF (
CurrentTest = "Effective",
SWITCH (
CurrentReview,
"Effective", "Effective",
"Ineffective", "Ineffective",
"Open", PreviousReview
)
)
RETURN
COALESCE ( Result, 'Table'[Test] )
Great, this works perfectly!! Thanks!!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |