Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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!!
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
109 | |
100 | |
95 | |
38 | |
37 |
User | Count |
---|---|
152 | |
125 | |
75 | |
74 | |
63 |